Saved Query is not working via API google ad manager(report service api)

Viewed 428

We attempted to download a report that created on UI via the Python client and we get a response 'isCompatibleWithApiVersion': False with all versions of the client( v202102, v202011, v202008,v202105)

from googleads import ad_manager
from googleads import errors

SAVED_QUERY_ID = '12456###'

client = ad_manager.AdManagerClient.LoadFromStorage()

# Initialize appropriate service.
report_service = client.GetService('ReportService', version='v202105')

# Initialize a DataDownloader.
report_downloader = client.GetDataDownloader(version='v202105')

# Create statement object to filter for an order.
statement = (ad_manager.StatementBuilder(version='v202105')
           .Where('id = :id')
           .WithBindVariable('id', int(saved_query_id))
           .Limit(2))

response = report_service.getSavedQueriesByStatement(statement.ToStatement())
print(response)

Is it possible to download exact report that created on UI (Google ad manager). refrence link: https://github.com/googleads/googleads-python-lib/blob/master/examples/ad_manager/v202105/report_service/run_saved_query.py

2 Answers

i experienced the same issue. it seems not all kind of reports that you created on UI can be procesed via api.

on those cases google said that you need to create that same report on api side and run it from there..

I ran across this same issue. After some experimenting, I discovered that I could not retrieve a saved query if either of these were true:

  • The report used Custom Dimensions
  • The report used any other Date Range besides Fixed

I duplicated the report I was trying to retrieve in the UI, made these changes, retrieved the query of the duplicated report, and then modified the query to add the custom dimensions and date ranges I needed.

Related