Jarad
Jarad

Reputation: 18983

Python: Adwords API: How to Return a List of Available Report Types Using the API?

On this page, there are the available report types: https://developers.google.com/adwords/api/docs/appendix/reports

Using an Adwords Service, is it possible to get a list of available report types?

Ex: Using the reportDefinitionService, it's possible to get report FIELDS:

adwords_client = adwords.AdWordsClient(developer_token, oauth2_client, user_agent,
                                       client_customer_id=client_customer_id)
service = adwords_client.GetService('ReportDefinitionService', api_version)
service_response = service.getReportFields('ACCOUNT_PERFORMANCE_REPORT')

for field in service_response:
  print(field.fieldName)

Returns:

AccountCurrencyCode
AccountDescriptiveName
AccountTimeZoneId
ActiveViewCpm
ActiveViewCtr
ActiveViewImpressions
...
VideoViews
ViewThroughConversions
Week
Year

I want to do the same thing, but instead of returning available fields for a given report type, I want to return the names of report types.

Ex: desired output:

ACCOUNT_PERFORMANCE_REPORT
ADGROUP_PERFORMANCE_REPORT
AD_CUSTOMIZERS_FEED_ITEM_REPORT
...
URL_PERFORMANCE_REPORT
USER_AD_DISTANCE_REPORT
VIDEO_PERFORMANCE_REPORT

Which Adwords API service exists to do this?

Upvotes: 0

Views: 528

Answers (1)

patito
patito

Reputation: 540

AFAIK there is no way to query for this, you would have to read the documentation and choose your report type.

If you want to automate it, I suggest you take a list of all the online reports:

[https://developers.google.com/adwords/api/docs/appendix/reports][1]

and then do:

for report_type in report_types:
  service_response = service.getReportFields(report_type)

this would get you all the fields for each respective report type

Upvotes: 2

Related Questions