struggling with my first API call

85 views
Skip to first unread message

Kyle Zengo

unread,
Feb 2, 2022, 7:10:14 PM2/2/22
to Google Ads API and AdWords API Forum
Hello,

I'm struggling to make my first API call, as described here.

When I run "get_campaigns.py" I get this error:

Request with ID "..." failed with status "PERMISSION_DENIED" and includes the following errors:
        Error with message "User doesn't have permission to access customer. Note: If you're accessing a client customer, the manager's customer id must be set in the 'login-customer-id' header. See https://developers.google.com/google-ads/api/docs/concepts/call-structure#cid".

I am running this on a windows machine through Anaconda Prompt. In the "basic_operations" directory I execute: python get_campaigns.py -c MY_CLIENT_ID. "MY_CLIENT_ID" is the ID of the client who's campaigns I am trying to see. This client is under my test MCC account. 

I think something might be wrong with my google-ads.yaml file, but I'm not sure what. It's set up as:

use_proto_plus: True (added this in based on an error message, but it's not included here)
developer_token: TEST TOKEN FROM MY PRODUCTION GOOGLE ADS ACCOUNT
client_id: CLIENT ID FROM MY PRODUCTION CLIENT'S GOOGLE ADS APP
client_secret:  CLIENT SECRET FROM MY PRODUCTION CLIENT'S GOOGLE ADS APP
refresh_token: REFRESH TOKEN GENERATED FOLLOWING THESE INSTRUCTIONS
login_customer_id: ID FOR TEST MCC ACCOUNT


Are these values correct? If so, what else could generate the above error message?

Thank you!
Kyle





Google Ads API Forum Advisor

unread,
Feb 2, 2022, 8:35:38 PM2/2/22
to ky...@swellshark.com, adwor...@googlegroups.com

Hi Kyle,

Thanks for reaching out to the Google Ads API Forum.

Since you have encountered the PERMISSION_DENIED error, please ensure that the user email used to create the OAuth credentials also has the appropriate access for the Ads account that you are targeting. That said, kindly double check if your OAuth2 credentials are correct for the said user. If you still encounter an error, you may provide us with the  email address you used to generate the OAuth2 credentials, and complete request and response logs with the request-id generated, so our team can better check.

For the Python library, logging can be enabled by navigating to the Client libraries > Your client library (select Python) > Logging documentation, which you can access from this link. You may then send the requested information via the Reply privately to author option. If this option is not available, you may send the details directly to our googleadsa...@google.com alias instead.

Regards,

Google Logo
Yasar
Google Ads API Team
 

 

 



ref:_00D1U1174p._5004Q2W3qzO:ref

Kyle Zengo

unread,
Feb 2, 2022, 8:56:17 PM2/2/22
to Google Ads API and AdWords API Forum
Excellent! Thank you so much! I added my Production account as an Admin user for my test account, and the command worked as expected.

Google Ads API Forum Advisor

unread,
Feb 2, 2022, 10:38:29 PM2/2/22
to ky...@swellshark.com, adwor...@googlegroups.com

Hi Kyle,

Glad to hear that your request works fine. Feel free to reach out to us again if you have any additional questions related to our API’s.

Regards,

Reply all
Reply to author
Forward
0 new messages