Getting Empty Response from Google Ads API Query

56 views
Skip to first unread message

Qingyuan Li

unread,
Feb 25, 2025, 3:39:05 PM2/25/25
to Google Ads API and AdWords API Forum
Hi all:

I'm desperately trying to connect to Google Ads API, and I tried a query, and got empty result. There's no error; there's just nothing returned, maybe null as a result. 

What's going on...
from google.ads.googleads.client import GoogleAdsClient
client = GoogleAdsClient.load_from_storage("google-ads.yaml")
def main(client, customer_id):
    ga_service = client.get_service("GoogleAdsService")

    query = """
        SELECT
          campaign.id,
          campaign.name
        FROM campaign
        ORDER BY campaign.id"""

    # Issues a search request using streaming.
    stream = ga_service.search_stream(customer_id=customer_id, query=query)

    for batch in stream:
        for row in batch.results:
            print(
                f"Campaign with ID {row.campaign.id} and name "
                f'"{row.campaign.name}" was found.'
            )
main(client,customer_id)



# The code run, and returns nothing

Google Ads API Forum Advisor

unread,
Feb 25, 2025, 4:21:28 PM2/25/25
to qing...@petlibro.com, adwor...@googlegroups.com

Hi,

Thank you for reaching out to the Google Ads API support team.

In order to investigate the issue further, could you please provide us with the complete API logs (request and response with request-id and request header) generated at your end.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java, .Net, PHP, Python, Ruby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

You can share the requested details via Reply privately to the author option or a direct private reply to this email. 

Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5
[2025-02-25 21:20:50Z GMT] This message is in relation to case "ref:!00D1U01174p.!5004Q02vH3vs:ref" (ADR-00289816)



Reply all
Reply to author
Forward
0 new messages