ACCOUNT_PERFORMANCE_REPORT - return '400 Bad Request'

99 views
Skip to first unread message

lis...@e-n-a.jp

unread,
Feb 19, 2020, 8:01:07 PM2/19/20
to AdWords API and Google Ads API Forum
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
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?

Google Ads API Forum Advisor Prod

unread,
Feb 20, 2020, 3:37:52 PM2/20/20
to lis...@e-n-a.jp, adwor...@googlegroups.com

Hello,

Thank you for reaching out. I took a closer look into your report query and found that you are trying to set the ordering in your report query. Please note, the ORDER BY clause is disallowed in report calls. Please refer to this guide for more details on the formal grammar of AdWords Query Language. Could you please remove the ordering and retry your request? If the issue persists, could you please share the report definition along with the client customer id for further investigation?

P.S. Please use Reply privately to author option while sharing the details.

Regards,
Nikisha Patel, Google Ads API Team



ref:_00D1U1174p._5001UV1fyo:ref

lis...@e-n-a.jp

unread,
Feb 24, 2020, 8:23:16 PM2/24/20
to AdWords API and Google Ads API Forum
I fixed this error.

I don't need title, summary, etc... So I removed this code.

$reportDefinition->setReportName('Custom ADGROUP_PERFORMANCE_REPORT');

When I added this code, it worked.

Thank you for your answer.

2020年2月21日金曜日 5時37分52秒 UTC+9 adsapiforumadvisor:
Reply all
Reply to author
Forward
0 new messages