I want to do some reporting, but always get this error. How can i solve?

class DownloadCriteriaReportWithSelector {

  public static function runExample(AdWordsSession $session, $filePath) {
    // Create selector.
    $selector = new Selector();
    $selector->setFields(['CampaignId']);

    // Use a predicate to filter out paused criteria (this is optional).
    $selector->setPredicates([
        new Predicate('Status', PredicateOperator::NOT_IN, ['PAUSED'])]);

    // Create report definition.
    $reportDefinition = new ReportDefinition();
    $reportDefinition->setSelector($selector);
    $reportDefinition->setReportName(
        'Criteria performance report #' . uniqid());
    $reportDefinition->setDateRangeType(
        ReportDefinitionDateRangeType::LAST_7_DAYS);
    $reportDefinition->setReportType(
        ReportDefinitionReportType::CRITERIA_PERFORMANCE_REPORT);
    $reportDefinition->setDownloadFormat(DownloadFormat::CSV);

    // Download report.
    $reportDownloader = new ReportDownloader($session);
    // Optional: If you need to adjust report settings just for this one
    // request, you can create and supply the settings override here. 
Otherwise,
    // default values from the configuration file (adsapi_php.ini) are used.
    $reportSettingsOverride = (new ReportSettingsBuilder())
        ->includeZeroImpressions(false)
        ->build();
    $reportDownloadResult = $reportDownloader->downloadReport(
        $reportDefinition, $reportSettingsOverride);
    $reportDownloadResult->saveToFile($filePath);
    printf("Report with name '%s' was downloaded to '%s'.\n",
        $reportDefinition->getReportName(), $filePath);
  }

  public static function main() {
    // Generate a refreshable OAuth2 credential for authentication.
    $oAuth2Credential = (new OAuth2TokenBuilder())
        ->fromFile()
        ->build();

    // See: AdWordsSessionBuilder for setting a client customer ID that is
    // different from that specified in your adsapi_php.ini file.
    // Construct an API session configured from a properties file and the 
OAuth2
    // credentials above.
    $session = (new AdWordsSessionBuilder())
        ->fromFile()
        ->withOAuth2Credential($oAuth2Credential)
        ->build();

    $filePath = sprintf(
        '%s.csv',
        tempnam(sys_get_temp_dir(), 'criteria-report-')
    );
    self::runExample($session, $filePath);
  }
}

DownloadCriteriaReportWithSelector::main();



Following the error:

Dominiks-iMac:adwords Dominik$ php DownloadCriteriaReportWithSelector.php

[2018-02-12 12:22:51] AW_REPORT_DOWNLOADER.WARNING: 
clientCustomerId=608-580-1167 ###### (AwApi-PHP, googleads-php-lib/32.1.0, 
PHP/7.1.11, GuzzleHttp/6.2.1, curl/7.45.0) "POST 
/api/adwords/reportdownload/v201710 HTTP/1.1" Status: 400   

[2018-02-12 12:22:51] AW_REPORT_DOWNLOADER.NOTICE: Request:

POST /api/adwords/reportdownload/v201710 HTTP/1.1

Content-Type: application/x-www-form-urlencoded

Host: adwords.google.com

Authorization: REDACTED

developerToken: REDACTED

clientCustomerId: #########

User-Agent: ######## (AwApi-PHP, googleads-php-lib/32.1.0, PHP/7.1.11, 
GuzzleHttp/6.2.1, curl/7.45.0)

skipReportHeader: false

skipColumnHeader: false

skipReportSummary: false

useRawEnumValues: false

includeZeroImpressions: false


__rdxml=<?xml version="1.0"?>

<reportDefinition><selector><fields>CampaignId</fields><predicates><field>Status</field><operator>NOT_IN</operator><values>PAUSED</values></predicates></selector><reportName>Criteria
 
performance report 
#5a81790a0c817</reportName><reportType>CRITERIA_PERFORMANCE_REPORT</reportType><dateRangeType>LAST_7_DAYS</dateRangeType><downloadFormat>CSV</downloadFormat></reportDefinition>



Response:

REDACTED REPORT DATA

--------

Error:

Client error: `POST 
https://adwords.google.com/api/adwords/reportdownload/v201710` resulted in 
a `400 Bad Request` response

  

PHP Fatal error:  Uncaught Google\AdsApi\AdWords\v201710\cm\ApiException: 
Details: [fieldPath: selector.reportDefinition; trigger: ; errorString: 
ReportDefinitionError.CUSTOMER_SERVING_TYPE_REPORT_MISMATCH] in 
/Applications/XAMPP/xamppfiles/htdocs/crm/adwords/googleads-php-lib/src/Google/AdsApi/AdWords/Reporting/v201710/ReportDownloader.php:168

Stack trace:

#0 
/Applications/XAMPP/xamppfiles/htdocs/crm/adwords/googleads-php-lib/src/Google/AdsApi/AdWords/Reporting/v201710/ReportDownloader.php(106):
 
Google\AdsApi\AdWords\Reporting\v201710\ReportDownloader->makeReportRequest(Array)

#1 
/Applications/XAMPP/xamppfiles/htdocs/crm/adwords/DownloadCriteriaReportWithSelector.php(68):
 
Google\AdsApi\AdWords\Reporting\v201710\ReportDownloader->downloadReport(Object(Google\AdsApi\AdWords\Reporting\v201710\ReportDefinition),
 
Object(Google\AdsApi\AdWords\ReportSettings))

#2 
/Applications/XAMPP/xamppfiles/htdocs/crm/adwords/DownloadCriteriaReportWithSelector.php(93):
 
Google\AdsApi\Examples\AdWords\v201710\Reporting\DownloadCriteriaReportWithSel 
in 
/Applications/XAMPP/xamppfiles/htdocs/crm/adwords/googleads-php-lib/src/Google/AdsApi/AdWords/Reporting/v201710/ReportDownloader.php
 
on line 168


Fatal error: Uncaught Google\AdsApi\AdWords\v201710\cm\ApiException: 
Details: [fieldPath: selector.reportDefinition; trigger: ; errorString: 
ReportDefinitionError.CUSTOMER_SERVING_TYPE_REPORT_MISMATCH] in 
/Applications/XAMPP/xamppfiles/htdocs/crm/adwords/googleads-php-lib/src/Google/AdsApi/AdWords/Reporting/v201710/ReportDownloader.php:168

Stack trace:

#0 
/Applications/XAMPP/xamppfiles/htdocs/crm/adwords/googleads-php-lib/src/Google/AdsApi/AdWords/Reporting/v201710/ReportDownloader.php(106):
 
Google\AdsApi\AdWords\Reporting\v201710\ReportDownloader->makeReportRequest(Array)

#1 
/Applications/XAMPP/xamppfiles/htdocs/crm/adwords/DownloadCriteriaReportWithSelector.php(68):
 
Google\AdsApi\AdWords\Reporting\v201710\ReportDownloader->downloadReport(Object(Google\AdsApi\AdWords\Reporting\v201710\ReportDefinition),
 
Object(Google\AdsApi\AdWords\ReportSettings))

#2 
/Applications/XAMPP/xamppfiles/htdocs/crm/adwords/DownloadCriteriaReportWithSelector.php(93):
 
Google\AdsApi\Examples\AdWords\v201710\Reporting\DownloadCriteriaReportWithSel 
in 
/Applications/XAMPP/xamppfiles/htdocs/crm/adwords/googleads-php-lib/src/Google/AdsApi/AdWords/Reporting/v201710/ReportDownloader.php
 
on line 168



How can i solve this?


-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/d1b1335e-3a60-4810-ba49-1ddb1f0f881d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • DownloadCrit... Dominik Raffetseder
    • Re: Dow... 'Milind Sankeshware (AdWords API Team)' via AdWords API Forum
    • Re: Dow... 'Milind Sankeshware (AdWords API Team)' via AdWords API Forum
    • Re: Dow... 'Milind Sankeshware (AdWords API Team)' via AdWords API Forum

Reply via email to