Get Campaigns in general account (not manager account)

42 views
Skip to first unread message

Oleg Disrupt

unread,
Oct 21, 2022, 3:46:41 AM10/21/22
to Google Ads API and AdWords API Forum
Hello
I tried to get the campaigns using google-ads-php sdk.
I tried to get the campaigns by using one account in my manager account so I can get the campaigns list successfully
for example
php examples/BasicOperations/GetCampaigns.php --customerId xxxxxx0632

but I tried to get them with general account (not inside manager account) so it shows error

error is

ApiException was thrown with message '{
    "message": "The caller does not have permission",
    "code": 7,
    "status": "PERMISSION_DENIED",
    "details": [
        {
            "@type": "type.googleapis.com\/google.ads.googleads.v11.errors.GoogleAdsFailure",
            "errors": [
                {
                    "errorCode": {
                        "authorizationError": "USER_PERMISSION_DENIED"
                    },
                    "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"
                }
            ],
            "requestId": "oPSM3-sbB3ml9QpAmXh5AA"
        }
    ]
}'.

So how can i get the campaigns in general account?
Thanks

Google Ads API Forum Advisor

unread,
Oct 21, 2022, 5:47:32 AM10/21/22
to ol...@disrupt.social, adwor...@googlegroups.com
Hi,

This is Carmela from the Google Ads API team. Thank you for reaching out.

With regard to your concern, it appears that you have encountered the USER_PERMISSION_DENIED. It means that the authorized customer does not have access to the operating customer. It's common cause is when authenticating as a user with access to a manager account but not specifying login-customer-id in the request. That said, I would suggest specifying the login-customer-id as the manager account ID without hyphens (-). Client libraries have built in support for this, or see our guide.

If the issue persists even after doing this, then you may provide the complete request and response logs with request ID and request header generated on your end so our team can provide guidance accordingly? If you haven't yet, logging can be enabled by navigating to the Client libraries > Your client library (ex. Java) > Logging documentation, which you can access from this link. You can provide it via Reply privately to author option. If this option is not available, then send it instead on this email address googleadsa...@google.com.

Regards,
Google Logo
Carmela
Google Ads API Team
 


ref:_00D1U1174p._5004Q2cOoUD:ref
Reply all
Reply to author
Forward
0 new messages