RE: Empty Result in GetCampaigns in Google Ads API

743 views
Skip to first unread message
Message has been deleted

Google Ads API Forum Advisor

unread,
Apr 1, 2022, 7:49:16 AM4/1/22
to ruke...@gmail.com, adwor...@googlegroups.com

Hi Rukesh,

 

I'm Kevin from the Google Ads API Team.

 

Please note that metric reports such as the one you're trying to generate can only be requested on a client account, not a MCC account. Kindly retry your request on a client account and see if you're able to retrieve any data.

 

Also, I'll remove your initial post as it contains private info which shouldn't be shared in our forum. Below is a copy of your post without a link to the document for reference.

 

Hello all,

 

I am currently working on shifting an API from Adwords API to Google Ads API.

I followed the below guidelines

https://github.com/googleads/google-ads-php/tree/main

 

After that, I tried to run the sample example code of 'GetCampaigns.php'.

 

However, I get an empty response.

Below are my request code piece:

$googleAdsServiceClient = $googleAdsClient->getGoogleAdsServiceClient();

$query = 'SELECT campaign.idcampaign.name FROM campaign ORDER BY campaign.id';

$stream =$googleAdsServiceClient->searchStream($customerId, $query);

 

I logged the $stream from here.

I got following:

 

I could not get the Campaigns.

 

Please help.

 

Regards,

Rukesh

 

Regards,

Google Logo
Kevin Gil
Google Ads API Team
 


ref:_00D1U1174p._5004Q2ZIjHH:ref

Rukesh Prajapati

unread,
Apr 3, 2022, 4:11:59 AM4/3/22
to ads...@forumsupport.google, adwor...@googlegroups.com
Hello Kevin,

Thank you for your reply.

I tried to use the customer ID(https://prnt.sc/rwbfXMfHoat0).
However, it gave me following error:

Request with ID 'XXXXXXXXXXX' has failed. Google Ads failure details: authorization_error: 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

It says Permission Denied.

Permission issue does not show up only if I use Manager ID (https://prnt.sc/IbYFdyuIAzVe).

Can you please explain which ID should I use?

It would be great help.

Regards,
Rukesh
--
Kind regards,
Rukesh

Google Ads API Forum Advisor

unread,
Apr 4, 2022, 3:24:43 AM4/4/22
to ruke...@gmail.com, adwor...@googlegroups.com
Hi Rukesh,

Thank you for the updates.

Could you provide more details on the concern/issue? Could you provide to our team the complete request and response logs with request ID so we can check it further.

Best regards,
Google Logo
Heidi
Google Ads API Team
 


ref:_00D1U1174p._5004Q2ZIjHH:ref

Rukesh Prajapati

unread,
Apr 4, 2022, 11:58:59 PM4/4/22
to Google Ads API and AdWords API Forum
Thank you all for support.

I have fixed the issue.
I have shifted from AdWords' API to Google Ads API. I used the credential file (.ini) file from Adwords API without any modification. That is causing the issue.

We have to add the manager ID in the 'google_ads_php.ini' file as loginCustomerId='MANAGER_ID' and use the client id in the code (https://github.com/googleads/google-ads-php/blob/main/examples/BasicOperations/GetCampaigns.php).
That fixed my issue.

Regards,
Rukesh

Google Ads API Forum Advisor

unread,
Apr 5, 2022, 1:06:37 AM4/5/22
to ruke...@gmail.com, adwor...@googlegroups.com
Hi Rukesh,

Thank you for the updates.

We're glad that you were able to find the information related to your concern. If you have additional questions regarding the topic being discussed in this thread, feel free to send those over to our team and we would be happy to assist you further.
Reply all
Reply to author
Forward
0 new messages