I'm trying to get Account Performance Report with AdWords API, But I got
'400 Bad Request' error .
When I tried a couple days ago, it worked.
Here's my code :
$selector = new Selector();
$selector->setFields(
[
'AccountDescriptiveName',
'Date',
'ExternalCustomerId',
'AccountCurrencyCode',
'Impressions',
'Clicks',
'Ctr',
'AverageCpc',
'Cost',
'Conversions',
'CostPerConversion',
'ConversionValue',
]
);
$selector->setOrdering(
[
'AccountDescriptiveName',
'Date',
'ExternalCustomerId',
]
);
$reportDefinition = new ReportDefinition();
$reportDefinition->setSelector($selector);
$reportDefinition->setDateRangeType(
ReportDefinitionDateRangeType::THIS_MONTH
);
$reportDefinition->setReportType(
ReportDefinitionReportType::ACCOUNT_PERFORMANCE_REPORT
);
$reportDefinition->setDownloadFormat(DownloadFormat::CSVFOREXCEL);
And error message :
Error:
Client error: `POST
https://adwords.google.com/api/adwords/reportdownload/v201809` resulted in
a `400 Bad Request` response
[2020-02-20 09:33:38] AW_REPORT_DOWNLOADER.WARNING:
clientCustomerId=[clientCustomerId] [userAgent] (AwApi-PHP,
googleads-php-lib/44.0.0, PHP/7.3.11, GuzzleHttp/6.5.1, curl/7.61.1) "POST
/api/adwords/reportdownload/v201809 HTTP/1.1" Status: 400
[2020-02-20 09:33:38] AW_REPORT_DOWNLOADER.NOTICE: Request:
POST /api/adwords/reportdownload/v201809 HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Host: adwords.google.com
Authorization: REDACTED
developerToken: REDACTED
clientCustomerId: [clientCustomerId]
User-Agent: [User-Agent] (AwApi-PHP, googleads-php-lib/44.0.0, PHP/7.3.11,
GuzzleHttp/6.5.1, curl/7.61.1)
skipReportHeader: true
skipColumnHeader: true
skipReportSummary: true
useRawEnumValues: false
includeZeroImpressions: false
__rdxml=<?xml version="1.0"?>
<reportDefinition><selector><fields>AccountDescriptiveName</fields><fields>Date</fields><fields>ExternalCustomerId</fields><fields>AccountCurrencyCode</fields><fields>Impressions</fields><fields>Clicks</fields><fields>Ctr</fields><fields>AverageCpc</fields><fields>Cost</fields><fields>Conversions</fields><fields>CostPerConversion</fields><fields>ConversionValue</fields><ordering>AccountDescriptiveName</ordering><ordering>Date</ordering><ordering>ExternalCustomerId</ordering></selector><reportType>ACCOUNT_PERFORMANCE_REPORT</reportType><dateRangeType>THIS_MONTH</dateRangeType><downloadFormat>CSVFOREXCEL</downloadFormat></reportDefinition>
Response:
REDACTED REPORT DATA
How can I fix this?
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/f92eae93-b2ae-442b-a040-becd1e791bb2%40googlegroups.com.