Audience Performance Report - Bad Request

60 views
Skip to first unread message

lucie.ra...@gmail.com

unread,
Apr 12, 2019, 8:04:01 AM4/12/19
to AdWords API and Google Ads API Forum
Hi API team,

I'm trying to download data from Audience Performace Report and getting bad request error, INVALID_FIELD_NAME_FOR_REPORT, but it is not possible, becauce I have double check fields in report and this should be correct, anyways, any help is appreciated as always.

Below you can check my query, nothing special, using pyhon, 

import sys
from googleads import adwords

def main(client):
report_downloader = client.GetReportDownloader(version='v201809')

report = {
'reportName': 'AUDIENCE_PERFORMANCE_REPORT',
'dateRangeType': 'CUSTOM_DATE',
'reportType': 'AUDIENCE_PERFORMANCE_REPORT',
'downloadFormat': 'CSV',
'selector': {
'fields': [ 'AccountDescriptiveName',
'ExternalCustomerId',
'AccountCurrencyCode',
'CampaignId',
'CampaignName',
'CampaignStatus',
'AdGroupName',
'Year',
'MonthOfYear',
'Criteria'
'Device'
'Impressions',
'Clicks',
'VideoViews',
'Cost',
'VideoQuartile25Rate',
'VideoQuartile50Rate',
'VideoQuartile75Rate',
'VideoQuartile100Rate'
],
'dateRange':{'min':'20180101','max':'20181231'}
}
}

path = 'C:/Queries/Geo/csv/audience.csv'
f = open(path, 'wb')

report_downloader.DownloadReport(
report, f,skip_report_header=False, skip_column_header=False,skip_report_summary=False, include_zero_impressions=False)
f.close()

if __name__ == '__main__':
adwords_client = adwords.AdWordsClient.LoadFromStorage()
adwords_client.SetClientCustomerId('899-840-8275')
main(adwords_client)

------------------------------------------------------------------------------------------------Error

Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. PS C:\Wunderman\Google_Adwords_API\Queries\RUN> & C:/Wunderman/Python36/python.exe c:/Wunderman/Google_Adwords_API/Queries/Geo/Audience_file.py Your default encoding, cp65001, is not UTF-8. Please run this script with UTF-8 encoding to avoid errors. Request Summary: {'clientCustomerId': '899-840-8275', 'includeZeroImpressions': 'False', 'server': 'adwords.google.com', 'skipColumnHeader': 'False', 'skipReportHeader': 'False', 'skipReportSummary': 'False', 'isError': True, 'errorMessage': '<?xml version="1.0" encoding="UTF-8" standalone="yes"?><reportDownloadError><ApiError><type>ReportDefinitionError.INVALID_FIELD_NAME_FOR_REPORT</type><trigger>CriteriaDeviceImpressions</trigger><fieldPath></fieldPath></ApiError></reportDownloadError>'} Traceback (most recent call last): File "C:\Wunderman\Python36\lib\site-packages\googleads\adwords.py", line 1686, in _DownloadReportAsStream response = self.url_opener.open(request) File "C:\Wunderman\Python36\lib\urllib\request.py", line 532, in open response = meth(req, response) File "C:\Wunderman\Python36\lib\urllib\request.py", line 642, in http_response 'http', request, response, code, msg, hdrs) File "C:\Wunderman\Python36\lib\urllib\request.py", line 570, in error return self._call_chain(*args) File "C:\Wunderman\Python36\lib\urllib\request.py", line 504, in _call_chain result = func(*args) File "C:\Wunderman\Python36\lib\urllib\request.py", line 650, in http_error_default raise HTTPError(req.full_url, code, msg, hdrs, fp) urllib.error.HTTPError: HTTP Error 400: Bad Request During handling of the above exception, another exception occurred: Traceback (most recent call last): File "c:/Wunderman/Google_Adwords_API/Queries/Geo/Audience_file.py", line 47, in <module> main(adwords_client) File "c:/Wunderman/Google_Adwords_API/Queries/Geo/Audience_file.py", line 41, in main report, f,skip_report_header=False, skip_column_header=False,skip_report_summary=False, include_zero_impressions=False) File "C:\Wunderman\Python36\lib\site-packages\googleads\common.py", line 543, in Wrapper return utility_method(*args, **kwargs) File "C:\Wunderman\Python36\lib\site-packages\googleads\adwords.py", line 1337, in DownloadReport output, **kwargs) File "C:\Wunderman\Python36\lib\site-packages\googleads\adwords.py", line 1610, in _DownloadReport response = self._DownloadReportAsStream(post_body, **kwargs) File "C:\Wunderman\Python36\lib\site-packages\googleads\adwords.py", line 1703, in _DownloadReportAsStream raise error googleads.errors.AdWordsReportBadRequestError: Type: ReportDefinitionError.INVALID_FIELD_NAME_FOR_REPORT Trigger: CriteriaDeviceImpressions Field Path: None PS C:\Wunderman\Google_Adwords_API\Queries\RUN>

googleadsapi...@google.com

unread,
Apr 12, 2019, 10:24:16 AM4/12/19
to lucie.ra...@gmail.com, AdWords API and Google Ads API Forum
Hello Lucie, 

Thank you for sharing the details. The report query is missing the commas after Criteria and Device fields. Could you please add these and retry the request?

Regards,
Bharani, Google Ads API Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

lucie.ra...@gmail.com

unread,
Apr 12, 2019, 10:33:33 AM4/12/19
to AdWords API and Google Ads API Forum
Hi Bharani,

Oh no, I must be tired, I overlooked these, yes, now it is running, funny, sorry, please close this.

Lucie
Reply all
Reply to author
Forward
0 new messages