Hi Silvester,
>From quick glance, it seems you are posting your request against a wrong
endpoint
('https://adwords.google.com/api/adwords/reportdownload/*v201109*<https://adwords.google.com/api/adwords/reportdownload/v201109>'),
I believe you want to use *v201209 *instead.
If that is not the use, please email me directly your clientCustomerId and
I'll try to find you requests in our logs.
Best,
- David Torres - AdWords API Team
On Thursday, January 10, 2013 7:00:14 AM UTC-5, [email protected]
wrote:
>
> Iam trying to downlaod keyword performance report using the following php
> script.
>
> <?php
>
> // Account login details
> $username = "";
> $password = ";
> $customerId = "";
> $developerToken = "";
>
> // Get an access code for the user
> $url = "https://www.google.com/accounts/ClientLogin";
> $params = array(
> "accountType" => "GOOGLE",
> "Email" => $username,
> "Passwd" => $password,
> "service" => "adwords",
> "source" => "adluge.com"
> );
>
> $curl = curl_init();
> curl_setopt($curl, CURLOPT_URL, $url);
> curl_setopt($curl, CURLOPT_HEADER, false);
> curl_setopt($curl, CURLOPT_POST, true);
> curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
> curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
> curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
> $curlData = curl_exec($curl);
> curl_close($curl);
>
> // Parse the response
> $curlData = explode("\n", $curlData);
> $return = array();
> foreach ($curlData as $value) {
> $value = explode("=", $value, 2);
> if (count($value) > 1) {
> $return[$value[0]] = $value[1];
> }
> }
>
> // Extract the access token
> $authToken = $return["Auth"];
>
> $httpHeaders = array(
> "Authorization: GoogleLogin auth=$authToken","developerToken:
> $developerToken",
> "clientCustomerId: $customerId","returnMoneyInMicros: true");
> $reportDefinition ='<?xml version="1.0"?><reportDefinition xmlns="
> https://adwords.google.com/api/adwords/cm/v201209">';
> $reportDefinition .= "<selector>";
> $reportDefinition .= "<fields>Id</fields>";
> $reportDefinition .= "<fields>KeywordText</fields>";
> $reportDefinition .= "<fields>Impressions</fields>";
> $reportDefinition .= "<fields>Clicks</fields>";
> $reportDefinition .= "<fields>Ctr</fields>";
> $reportDefinition .= "<fields>Cost</fields>";
> $reportDefinition .= "<fields>AverageCpc</fields>";
> $reportDefinition .= "<fields>Conversions</fields>";
> $reportDefinition .= "<fields>ConversionValue</fields>";
> $reportDefinition .= "<fields>AveragePosition</fields>";
> $reportDefinition .= "<fields>CostPerConversionManyPerClick</fields>";
> $reportDefinition .= "<dateRange>";
> $reportDefinition .= "<min>20121201</min>";
> $reportDefinition .= "<max>20121231</max>";
> $reportDefinition .= "</dateRange>";
> $reportDefinition .= "</selector>";
> $reportDefinition .= "<reportName>Keyword Performance Report</reportName>";
> $reportDefinition .=
> "<reportType>KEYWORDS_PERFORMANCE_REPORT</reportType>";
> $reportDefinition .= "<dateRangeType>CUSTOM_DATE</dateRangeType>";
> $reportDefinition .= "<downloadFormat>CSV</downloadFormat>";
> $reportDefinition .= "</reportDefinition>";
>
> $params = array("__rdxml" => $reportDefinition);
>
> $url = 'https://adwords.google.com/api/adwords/reportdownload/v201109';
> // 'https://adwords.google.com/api/adwords/reportdownload/v201109';
> $curl = curl_init();
> curl_setopt($curl, CURLOPT_URL, $url);
> curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
> curl_setopt($curl, CURLOPT_HEADER, false);
> curl_setopt($curl, CURLOPT_POST, true);
> curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
> curl_setopt($curl, CURLOPT_HTTPHEADER, $httpHeaders);
> curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 0);
> curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
> $response = curl_exec($curl);
> $code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
> curl_close($curl);
>
> /* Debugging */
> print '<pre>Headers:<br />';
> print_r($headers);
> print '<hr />XML:<br />';
> print htmlentities($xml);
> print '<hr />';
> print 'HTTP Code: ' . $code . '<hr />';
> print htmlentities($response);
> print '<hr />Errors:<br />';
> $errors = array( 'errno' => curl_errno($ch), 'error' => curl_error($ch)) ;
> print_r($errors);
>
> But after executing the code Iam getting error "ReportDefinitionError.
> CUSTOMER_SERVING_TYPE_REPORT_MISMATCH selector"
> Iam using a MCC account username and password and a customerId under that
> account.
> Please help me to solve this issue.
>
> Thanks,
> Silvester
>
>
>
> ?>
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords 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