get customer campaigns list, REST API

1,591 views
Skip to first unread message

Anna Lysak

unread,
Sep 5, 2022, 7:14:34 AM9/5/22
to Google Ads API and AdWords API Forum
Hi again,

Could you please help me to find documentation to get all customer campaigns ? what query should I send and where ?

Thanks in advance.

Anna Lysak

unread,
Sep 5, 2022, 10:16:47 AM9/5/22
to Google Ads API and AdWords API Forum
This is what I tried:
I sent POST request to this : url = 'https://googleads.googleapis.com/v11/customers/6074981807/campaigns:search'
And this is the body:
params = {
 "query": "SELECT campaign.id, campaign.name, campaign.status FROM campaign ORDER BY campaign.id"
}
response = await aiohttp_session.post(url, json=params, headers=headers)

But I receive 404 status. Which is correct URL to get all customer campaigns ?

Thanks in advance.

Google Ads API Forum Advisor

unread,
Sep 5, 2022, 2:58:23 PM9/5/22
to gann...@gmail.com, adwor...@googlegroups.com

Hi Anna,

Thanks for reaching out to the Google Ads API Forum.

The URL sent is incorrect, and this is the reason you received the error 404. Instead, you may use the ‘https://googleads.googleapis.com/v11/customers/6074981807/googleAds:search' to get all the campaigns.

Following are the two endpoints to fetch the objects from Google Ads:

 

search

POST /v11/customers/{customerId}/googleAds:search

Returns all rows that match the search query.

searchStream

POST /v11/customers/{customerId}/googleAds:searchStream

Returns all rows that match the search stream query.



To get the all the campaigns, you may use below GAQL:

SELECT

  campaign.name,

  campaign.status, 

 metrics.impressions,

  metrics.clicks,

  metrics.ctr,

  metrics.average_cpc,

  metrics.cost_micros

FROM campaign

ORDER BY campaign.id

You may refer to this example guide for the reports. Also, the Query Cookbook guide contains many reporting samples that correspond to some of the default Google Ads screens and work with the same environment variables used in this guide. Our interactive query builder tool is also a great resource for building custom queries interactively.

Regards,

Google Logo
Yasar
Google Ads API Team
 

 

 



ref:_00D1U1174p._5004Q2dvToi:ref

Anna Lysak

unread,
Sep 6, 2022, 5:41:45 AM9/6/22
to Google Ads API and AdWords API Forum
Thank you very much! It works!
Reply all
Reply to author
Forward
0 new messages