How to get list of ads using google ads api

31 views
Skip to first unread message

Sergey Biryuzov

unread,
Feb 13, 2020, 6:43:35 AM2/13/20
to AdWords API and Google Ads API Forum
Hi,
I need to get list of all client ads for creating report which will show statistic on each ad (shows, clicks, average bid and a lot of others) for marketing needs. But I can't find in Docs "Request URL" for getting list of ads for client.
Unfortunately I can't use client libraries.

So I try to use method GoogleAdsService:Search -  Search REST/JSON.
I try to make call to the
https://googleads.googleapis.com/v2/customers/9032841878/googleAds:search
Using GAQL
['query' => 'SELECT campaign.id,campaign.name,metrics.impressions, metrics.clicks, metrics.ctr  FROM ad']
But I got error in response - "PROHIBITED_RESOURCE_TYPE_IN_FROM_CLAUSE"

How to solve my issue?

Full body of response
Array
(
   
[error] => Array
       
(
           
[code] => 400
           
[message] => Request contains an invalid argument.
           
[status] => INVALID_ARGUMENT
           
[details] => Array
               
(
                   
[0] => Array
                       
(
                           
[@type] => type.googleapis.com/google.ads.googleads.v2.errors.GoogleAdsFailure
                           
[errors] => Array
                               
(
                                   
[0] => Array
                                       
(
                                           
[errorCode] => Array
                                               
(
                                                   
[queryError] => PROHIBITED_RESOURCE_TYPE_IN_FROM_CLAUSE
                                               
)

                                           
[message] => ad may not be used in FROM clause in this service.
                                       
)

                               
)

                       
)

               
)

       
)

   
[code] => 400
)





Google Ads API Forum Advisor Prod

unread,
Feb 13, 2020, 3:23:22 PM2/13/20
to sbir...@gmail.com, adwor...@googlegroups.com

Hello Sergey,

Thank you for reaching out. From the shared details, I understand you are trying to use cURL to retrieve the ads details from your Google Ads account. The error 'PROHIBITED_RESOURCE_TYPE_IN_FROM_CLAUSE' is observed as you are trying to query the ad resource in your FROM clause instead of ad_group_ad resource which is available via Google Ads API Beta. Could you please modify the report query and let me know if you still have any issues?

Regards,
Nikisha Patel, Google Ads API Team



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