Can anyone please help me with diagnosing why the API endpoint is returning
a 404 error despite proper configuration?
So far, I've tried:
- Verifying correct project configuration
- Confirmed API is enabled
- Recreated OAuth credentials
-
Tried testing with simple GAQL query to fetch campaign data
My problem:
- Every API call results in a 404 (Not Found) error
- Tested multiple API versions (v14, v15, v16, v17, v18 and v19)
- API is confirmed as enabled in Google Cloud Console
- OAuth authentication completes successfully
- My developer token is valid (Basic)
- Customer ID is correctly formatted (no hyphens)
- I have a manager account (correctly formatted too)
- I added my script below, with auth. codes redacted.
I am not a coder by profession and I use Claude Sonnet to get me this far.
Ironically, the script for Google Analytics performs flawlessly - I thought
this would be "easy" too but I hit a brick wall with the script being
unable to move beyond the 404./
// Account info
const MANAGER_ID = '000000000'; // Manager Account ID
const CUSTOMER_ID = '000000000'; // Customer ID
const DEVELOPER_TOKEN = '000000000'; // Your developer token
function testGoogleAdsApiConnection() {
// Simple GAQL query to fetch one campaign
const query = `
SELECT
campaign.id,
campaign.name
FROM campaign
LIMIT 1
`;
try {
const url = `https://googleads.googleapis.com/v19/customers/${CUSTOMER_ID}
:search`;
const response = UrlFetchApp.fetch(url, {
method: 'post',
headers: {
'developer-token': DEVELOPER_TOKEN,
'login-customer-id': MANAGER_ID,
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + ScriptApp.getOAuthToken()
},
payload: JSON.stringify({
query: query
}),
muteHttpExceptions: true
});
// Log the response
Logger.log('Response Code: ' + response.getResponseCode());
Logger.log('Response Content: ' + response.getContentText());
} catch (e) {
Logger.log('Error: ' + e.toString());
}
}
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/adwords-api/4e776580-d7c6-47d2-8c9a-20019fe01b5bn%40googlegroups.com.