Google Ads API - not getting campaign data or any other data

236 views
Skip to first unread message

Tirth Barochia

unread,
Jul 14, 2023, 12:06:53 AM7/14/23
to Google Ads API and AdWords API Forum
I have follow all step to of connectivity. I get data of my google ads account like name, customer id, time zone etc. But when I call API for campaign details or any other ad group details at that time it is getting below output. In UI I can  see many campaigns but through API I can not getting it.

Output:

SearchPager<field_mask {
  paths: "campaign.id"
  paths: "ad_group.id"
  paths: "ad_group.name"
}
>

Code:

In result variable I got above value and after that for loop is not executing

ga_service = client.get_service("GoogleAdsService")

query = """
SELECT
FROM ad_group"""

if campaign_id:
query += f" WHERE campaign.id = {campaign_id}"

search_request = client.get_type("SearchGoogleAdsRequest")
search_request.customer_id = customer_id
search_request.query = query
search_request.page_size = _DEFAULT_PAGE_SIZE

results = ga_service.search(request=search_request)
print(results)
for row in results:
print(
f"Ad group with ID {row.ad_group.id} and name "
f'"{row.ad_group.name}" was found in campaign with '
f"ID {row.campaign.id}."
)

Google Ads API Forum Advisor

unread,
Jul 14, 2023, 1:49:25 AM7/14/23
to tirth.accu...@gmail.com, adwor...@googlegroups.com

Hi Tirth,

Thank you for reaching out to us.

For our team to further investigate this and provide appropriate recommendations to you, could you please provide us with the following information below:

Note that logs can be requested or provided to the developer handling the Google Ads API transactions when logging of the API requests has been enabled. You may check here and click your client library for the specific guideline to enable it.

You may then send the requested information via the Reply privately to author option. If this option is not available, you may send the details directly to our googleadsa...@google.com alias instead.

 
This message is in relation to case "ref:_00D1U1174p._5004Q2n7WZU:ref"

Thanks,
 
Google Logo Google Ads API Team


Reply all
Reply to author
Forward
0 new messages