Cannot Fetch the CustomerClient list from Customer ID using New API

68 views
Skip to first unread message

Ronak Shah

unread,
Nov 19, 2019, 8:16:16 AM11/19/19
to AdWords API and Google Ads API Forum
Hello,

We have just started using the new google ads api version 2.2, but we are not able to get the list of Customer Clients from Customer ID. We are testing the API call for the Test MCC accounts and we are able to fetch the list of accessible customers, but the details of customer client accounts from customer id is not coming and api call returns 0.  Here is the below Code


function linkAllClients($customerId, $access_token, $refresh_token) {

try {
// Generate a refreshable OAuth2 credential for authentication.
$oAuth2Credential = (new OAuth2TokenBuilder())->fromFile(config('adwords.ini_path'))->withClientId(config("adwords.client_id"))->withClientSecret(config("adwords.client_secret"))->withRefreshToken($refresh_token)->build();

        // Construct a Google Ads client configured from a properties file and the
        // OAuth2 credentials above.
$googleAdsClient = (new GoogleAdsClientBuilder())->fromFile(config('adwords.ini_path'))
->withLoginCustomerId($customerId)
->withOAuth2Credential($oAuth2Credential)
->build();

$googleAdsServiceClient = $googleAdsClient->getGoogleAdsServiceClient();

$query = 'SELECT customer_client.id, customer_client.level, customer_client.client_customer, customer_client.descriptive_name, customer_client.currency_code, customer_client.time_zone, customer_client.manager FROM customer_client';

$response = $googleAdsServiceClient->search($customerId, $query, ['pageSize' => 100]);

echo iterator_count($response->iterateAllElements());
die;

foreach ($response->iterateAllElements() as $googleAdsRow) {
$customerClient = $googleAdsRow->getCustomerClient();

}

} catch (GoogleAdsException $googleAdsException) {
printf(
"Request with ID '%s' has failed.%sGoogle Ads failure details:%s",
$googleAdsException->getRequestId(),
PHP_EOL,
PHP_EOL
);

foreach ($googleAdsException->getGoogleAdsFailure()->getErrors() as $error) {
/** @var GoogleAdsError $error */
printf(
"\t%s: %s%s",
$error->getErrorCode()->getErrorCode(),
$error->getMessage(),
PHP_EOL
);
}
die;

} catch (ApiException $apiException) {
printf(
"ApiException was thrown with message '%s'.%s",
$apiException->getMessage(),
PHP_EOL
);
die;

        } catch (\Exception $ex) {
       
        echo $ex->getMessage() . " : " . $ex->getFile() . " : " . $ex->getLine().PHP_EOL;
            die;
}
}

The above code returns 0 for iterator_count, where as there are accounts in test mcc account.


Please check

Thanks,
Ronak

Google Ads API Forum Advisor Prod

unread,
Nov 19, 2019, 3:06:37 PM11/19/19
to ro...@growthpilots.com, adwor...@googlegroups.com
Hi Ronak, 

Thank you for sharing the details. This is a known issue that the customer_client resource will not results for the Test accounts. Our team is taking a look into this and I will keep you posted on the updates. 

Regards,
Bharani, Google Ads API Team
 

ref:_00D1U1174p._5001UOCbrw:ref

Ronak Shah

unread,
Nov 20, 2019, 2:39:10 AM11/20/19
to AdWords API and Google Ads API Forum
Hello Bharani,

Thank you for your response! So I understand that this is a known issue and not sure how much time it will take to fix, but my question is how we can test the new API on test account? 

I want to develop the functions in new API which will make api call in test account to test the various api services. Does all other api services work with test accounts or no?

Thanks,
Ronak

Do 

Google Ads API Forum Advisor Prod

unread,
Nov 20, 2019, 6:05:37 PM11/20/19
to ro...@growthpilots.com, adwor...@googlegroups.com
Hi Ronak,

My name is Pierrick and I work as a Developer Advocate for Ads API.

Sure you can experiment the APIs against the test account. The main difference is that test accounts don't serve any actual ads, impressions or cost so data will often be zeroed out.

Thanks,
Pierrick - Ads API Team

ref:_00D1U1174p._5001UOCbrw:ref

Ronak Shah

unread,
Nov 22, 2019, 4:36:21 AM11/22/19
to AdWords API and Google Ads API Forum
Hi Pierrick,

I can confirm that the other api services works with the test account, but the customer_client service doesn't work with Test Accounts.

I hope this issue gets fix asap.

Thanks,
Ronak

Google Ads API Forum Advisor Prod

unread,
Nov 23, 2019, 5:13:53 PM11/23/19
to ro...@growthpilots.com, adwor...@googlegroups.com
Hi Ronak,

No ETA has been communicated yet by the Eng team but it is being actively addressed, we will keep you posted on the progress.
Reply all
Reply to author
Forward
0 new messages