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
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
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.