import { axios } from “@pipedream/platform”;
import { google } from “googleapis”;
export default defineComponent({
props: {
google_ads: {
type: “app”,
app: “google_ads”,
},
},
async run({ steps, $ }) {
// Step 1: Existing authentication step
const userInfo = await axios($, {
url: https://www.googleapis.com/oauth2/v1/userinfo
,
headers: {
Authorization: Bearer ${**this**.google_ads.$auth.oauth_access_token}
,
},
});
_// Step 2: Call Keyword Ideas API_
**const** customerId = "9998828401";
**const** languageId = "en"; _// E.g., en_
**const** locationIds = ["LOCATION_ID_1", "LOCATION_ID_2"]; _// E.g., ["2840", "2841"]_
**const** keywordTexts = ["KEYWORD_1", "KEYWORD_2"]; _// E.g., ["plumber", "drain cleaning"]_
**const** config = {
method: "POST",
url: `https://googleads.googleapis.com/v14/customers/${customerId}/keywordPlanIdea:generateKeywordIdeas`,
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${**this**.google_ads.$auth.oauth_access_token}`,
},
data: {
customerId: customerId,
language: `languageConstants/${languageId}`,
geoTargetConstants: locationIds.map((id) => `geoTargetConstants/${id}`),
includeAdultKeywords: **false**,
keywordSeed: {
keywords: keywordTexts,
},
},
};
**const** response = **await** axios($, config);
**return** {
userInfo: userInfo.data,
keywordIdeas: response.data,
};
},
});
This is my code. I am getting a 404 error saying that the URL doesn’t exist.
The requested URL /v14/customers/9998828401/keywordPlanIdea:generateKeywordIdeas
was not found on this server. That’s all we know.\n"
How do I make an actual API call to Google Ads?