Error when getting accessible customers from Google Ads Api

127 views
Skip to first unread message

Adbibo Technologies

unread,
May 9, 2019, 5:09:38 PM5/9/19
to AdWords API and Google Ads API Forum
Good morning,

We are trying to get a list of accessible customers from our account using the PHP Google Ads API, but we are receiving an error every time we try. The error is kind of generic:

ApiException was thrown with message '{ "message": "Internal error encountered.", "code": 13, "status": "INTERNAL", "details": [] }'.

 This is the code that produces the error:

$oAuth2Credential = (new OAuth2TokenBuilder())
        ->withClientId(env('GOOGLE_CLIENT_ID'))
        ->withClientSecret(env('GOOGLE_CLIENT_SECRET'))
        ->withRefreshToken(Auth::user()->google_refresh)
        ->build();
        // Construct a Google Ads client configured from a properties file and the
        // OAuth2 credentials above.
        $googleAdsClient = (new GoogleAdsClientBuilder())
            ->withOAuth2Credential($oAuth2Credential)
            ->withDeveloperToken(env('GOOGLE_DEVELOPER_TOKEN'))
            ->withLoginCustomerId(env('GOOGLE_CCI'))
            ->build();
        // dd($googleAdsClient);
        try {
            $customerServiceClient = $googleAdsClient->getCustomerServiceClient();
            // dd($customerServiceClient);
            // Issues a request for listing all accessible customers.
            $accessibleCustomers = $customerServiceClient->listAccessibleCustomers(); // THIS IS THE LINE WHICH ACTUALLY PRODUCES THE ERROR
            dd($accessibleCustomers);
            print 'Total results: ' . count($accessibleCustomers) . PHP_EOL;
            // Iterates over all accessible customers' resource names and prints them.
            foreach ($accessibleCustomers->getResourceNames() as $resourceName) {
                /** @var string $resourceName */
                printf("Customer resource name: '%s'%s", $resourceName, PHP_EOL);
            }  
        } catch (GoogleAdsException $googleAdsException) {
            // error handling...
        }


All the API tokens seem to be fine when using the AdWords API but seem to fail with the Ads API.
Has anyone experienced this issue or can shed some light on this?

Thank you very much in advance for your help.

Hope you have an excellent day


googleadsapi...@google.com

unread,
May 10, 2019, 1:18:23 AM5/10/19
to AdWords API and Google Ads API Forum
Hi,

Thank you for reaching out. To further investigate this, could you provide the complete JSON request and response logs when you encountered the error? If you haven't enabled logging yet, you may do so by following this guide.

Regards,
Dave
Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@googlegroups.com
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 "AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/1849c524-af83-4a16-bd32-b08982bbd76c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Adbibo Technologies

unread,
May 10, 2019, 5:08:36 PM5/10/19
to AdWords API and Google Ads API Forum
Hello,

thanks for your quick response. This is the logged response:
[2019-05-10 10:00:10] local.INFO: Request made: Host: "googleads.googleapis.com", Method: "/google.ads.googleads.v1.services.CustomerService/ListAccessibleCustomers", ClientCustomerId: 0, RequestId: "", IsFault: 1, FaultMessage: "None"  
[2019-05-10 10:00:10] local.INFO: Request
-------
Method Name: /google.ads.googleads.v1.services.CustomerService/ListAccessibleCustomers
Host: googleads.googleapis.com
Headers: {
    "x-goog-api-client": "gl-php\/7.2.17-0ubuntu0.18.04.1 gapic\/ gax\/0.38.0 grpc\/1.20.0",
    "developer-token": "REDACTED",
    "login-customer-id": "643-083-7108"
}
Request: {}
Response
-------
Headers: {
    "date": "Fri, 10 May 2019 10:00:10 GMT",
    "alt-svc": "quic=\":443\"; ma=2592000; v=\"46,44,43,39\""
}
Fault

[2019-05-10 10:00:10] local.INFO: Request made: Host: "googleads.googleapis.com", Method: "/google.ads.googleads.v1.services.CustomerService/ListAccessibleCustomers", ClientCustomerId: 0, RequestId: "", IsFault: 1, FaultMessage: "None"  
[2019-05-10 10:00:10] local.INFO: Request
-------
Method Name: /google.ads.googleads.v1.services.CustomerService/ListAccessibleCustomers
Host: googleads.googleapis.com
Headers: {
    "x-goog-api-client": "gl-php\/7.2.17-0ubuntu0.18.04.1 gapic\/ gax\/0.38.0 grpc\/1.20.0",
    "developer-token": "REDACTED",
    "login-customer-id": "XXX-XXX-XXXX" // removed for anonimity
}
Request: {}
Response
-------
Headers: {
    "date": "Fri, 10 May 2019 10:00:10 GMT",
    "alt-svc": "quic=\":443\"; ma=2592000; v=\"46,44,43,39\""
}
Fault
-------
Status code: 13
Details: Internal error encountered.
Failure: {}  

E
-------
Status code: 13
Details: Internal error encountered.
Failure: {}  

Still not very informative, but does it give any clue?

Thank you!

Kind regards,

Eneko 

googleadsapi...@google.com

unread,
May 14, 2019, 3:22:09 AM5/14/19
to AdWords API and Google Ads API Forum
Hi Eneko,

I am a colleague of Dave, allow me to provide support for your concern. 

Thank you for providing the logs. I do not see anything wrong with the API request. Can you provide the complete JSON logs without redacting any information (clientCustomerid if any, request Id) as this would help in our investigation?

Regards,
Dannison
Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Reply all
Reply to author
Forward
0 new messages