help with Api

20 views
Skip to first unread message

Дмитрий Бережной

unread,
Sep 8, 2017, 4:26:29 PM9/8/17
to AdWords API Forum
Api version 201708, I create the following query

$report_definition = new ReportDefinition($selector);
$report_definition->setReportName(self::_get_report_name($customer_id));
$report_definition->setDateRangeType(ReportDefinitionDateRangeType::CUSTOM_DATE);
$report_definition->setReportType(ReportDefinitionReportType::ACCOUNT_PERFORMANCE_REPORT);
$report_definition->setDownloadFormat(DownloadFormat::XML);

$report_downloader = new ReportDownloader($adwords_session_user);
$report_settings_override = (new ReportSettingsBuilder())
->includeZeroImpressions(true)
->build();

$report_download_result = $report_downloader->downloadReport($report_definition, $report_settings_override);
$report_download_result->saveToFile('/');

And I get the following

Google\AdsApi\AdWords\v201708\cm\ApiException [ 0 ]: Details: [fieldPath: ; trigger: Invalid ReportDefinition Xml: cvc-type.3.1.2: Element 'fields' is a simple type, so it must have no element information item [children].; errorString: ReportDownloadError.INVALID_REPORT_DEFINITION_XML]


What am I doing wrong ?


Sreelakshmi Sasidharan (AdWords API Team)

unread,
Sep 8, 2017, 4:59:23 PM9/8/17
to AdWords API Forum
Hi, 

Could you share the screenshot/code snippet of how you are setting your selector? You can refer to this sample in PHP to understand how to run reports using the API. Since you are using custom date range, please make sure to set the min and max dates as well.

Thanks,
Sreelakshmi, AdWords API Team
Reply all
Reply to author
Forward
0 new messages