Re: Post request for a report

2019-12-12 Thread Google Ads API Forum Advisor Prod
Hello,

I tried reaching out privately to your personal email. Could you please check 
your inbox for the email received from my end with the subject: 'Post request 
for a report' and respond to the same with the requested details for further 
troubleshooting? Let us know if you are still having trouble sharing the 
requested information.

Regards,
Nikisha Patel, Google Ads API Team
ref:_00D1U1174p._5001UOEFAB:ref

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 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 and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/M605C0Q2ELDR00vmrPOw_KR4aKGtzRy2P51g%40sfdc.net.


Re: Post request for a report

2019-12-11 Thread Василий Рогачев
really looking forward to your response!

On Wednesday, December 11, 2019 at 1:02:30 AM UTC+3, adsapiforumadvisor 
wrote:
>
> Hello,
>
> Thanks you for reaching the support. The error "The server encountered a 
> temporary error and could not complete your request" could be a transient 
> error. Could you please retry the API request to verify if the issue 
> persists? If the issue is consistent, could you please share the complete 
> request and response logs along with the client customer id for me to 
> investigate this further on my end?
>
> P.S: Please use *Reply privately to author* option while sharing the 
> details.
>
> Regards,
> Nikisha Patel, Google Ads API Team
>
>
> ref:_00D1U1174p._5001UOEFAB:ref
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 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 and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/6c62f70d-45e1-49e2-a417-c47542974ed9%40googlegroups.com.


Re: Post request for a report

2019-12-11 Thread Василий Рогачев
Your message to *adsapiforumadvi...@gmail.com* has been blocked. See 
technical details below for more information.

How then to send a message?

вторник, 10 декабря 2019 г., 20:52:18 UTC+3 пользователь Василий Рогачев 
написал:
>
>
> Good afternoon!
>
> First time working with the Adwords API. Before that, I worked with 
> Google's Contats API and there were no problems. And here I do not quite 
> understand why the request is not fulfilled?
>
> The program code in php below. An example of a query took 
> https://developers.google.com/adwords/api/docs/guides/reporting . But I 
> do not quite understand why there is no refresh token in the request ?
>
> *502.* That’s an error.
>
> The server encountered a temporary error and could not complete your 
> request.
>
>  $params1='{
>"reportDefinition": {
>"selector": {
>"fields": [
>"Campaign",
>"AdGroupId",
>"Impressions",
>"Clicks",
>"Cost"
>],
> "predicates": {
>"field": "AdGroupStatus",
>"operator": "IN",
>"values": [
>"ENABLED",
>"PAUSED"
>]
> }
>  },
>  "reportName": "Custom Adgroup Performance Report",
>  "reportType": "ADGROUP_PERFORMANCE_REPORT",
>  "dateRangeType": "LAST_7_DAYS",
>  "downloadFormat": "CSV",
>  "_xmlns": "https://adwords.google.com/api/adwords/cm/v201809;
>   }
> }';
> // Converts the input parameters of the query in JSON format
> $body = $params1;
>
> //print_r($body);
> //echo "___";
>
>
> // Creating HTTP request headers
>
>
>
> $headers = array(
>"Host: adwords.google.com",
>"User-Agent: curl, gzip",
>"Accept: /",
>"Accept-Encoding: gzip",
>"Authorization: Bearer ya29..g",
>"developerToken:NBQ",
>"clientCustomerId:124...li.apps.googleusercontent.com",
>"Content-Length: 784",
>"Expect: 100-continue",
>"Content-Type: multipart/form-data; 
> boundary=12d01fae60c7b559",
> );
>
>
>
>
>
>
>
> echo " < br>Adwords Report";
>
> // Curl initialization
> $curl = curl_init();
> curl_setopt($curl, CURLOPT_URL, $url);
> curl_setopt($curl, CURLOPT_POST, true);
> curl_setopt($curl, CURLOPT_POSTFIELDS, $body);
>
> /*
> To fully use the https Protocol, you can enable SSL certificate 
> verification of the direct API server.
> To enable validation, set the CURLOPT_SSL_VERIFYPEER option to true, and 
> uncomment the string with the CURLOPT_CAINFO option and specify the path to 
> the local copy of the root SSL certificate.
> */
> curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
> // curl_setopt($curl, CURLOPT_CAINFO, getcwd().'\CA.pem');
>
> curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
> curl_setopt($curl, CURLOPT_HEADER, true);
> curl_setopt($curl, CURLINFO_HEADER_OUT, true);
> curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
>
> // - - - Run a loop to execute queries ---
> // If HTTP code 200 is received, the report content is displayed
> // If HTTP code 201 or 202 is received, repeated requests are made
> while (true) {
>
> $result = curl_exec($curl);
>
> if (!$result) {
>
> echo ('curl error:'.curl_errno($curl).'- ' .curl_error($curl));
>
> break;
>
> } else {
>
> // Separation of HTTP headers and the response body
>$responseHeadersSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
>$responseHeaders = substr($result, 0, $responseHeadersSize);
>$responseBody = substr($result, $responseHeadersSize);
>
> // Get HTTP status code
>$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
>
> // Retrieving HTTP response headers
>// Request ID
>$requestId = preg_match('/RequestId: (\d+)/', $responseHeaders, 
> $arr)? $arr[1]: false;
>// Recommended interval in seconds to check if the report is ready
>$retryIn = preg_match('/retryIn: (\d+)/', $responseHeaders, $arr)? 
> $arr[1]: 60;
>
> if ($httpCode == 400) {
>
> echo " the query Parameters are incorrect or the limit of 
> reports in the queue has been reached";
>echo " RequestId: {$requestId}";
>echo " JSON request code:{$body}";
>echo " server response JSON:{$responseBody}";
>
> break;
>
> } elseif ($httpCode == 200) {
>
> echo " Report created successfully";
>echo " RequestId: {$requestId}";
>echo $responseBody;
>
> break;
>
> } elseif ($httpCode == 201) {
>
> echo "the Report was successfully queued in offline mode";
>echo " resend request after {$retryIn} seconds";
>echo " RequestId: {$requestId}";
>
> sleep($retryIn);
>
> } elseif ($httpCode == 202) {
>
> echo " the Report is generated 

RE: Post request for a report

2019-12-10 Thread Google Ads API Forum Advisor Prod
Hello,

Thanks you for reaching the support. The error "The server encountered a 
temporary error and could not complete your request" could be a transient 
error. Could you please retry the API request to verify if the issue persists? 
If the issue is consistent, could you please share the complete request and 
response logs along with the client customer id for me to investigate this 
further on my end?

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

Regards,
Nikisha Patel, Google Ads API Team
ref:_00D1U1174p._5001UOEFAB:ref

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 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 and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/vLBar0Q2BH4L00F6jaHRvATK6XuR8Uv5NbQg%40sfdc.net.


Re: Post request for a report

2019-12-10 Thread 'Василий Рогачев' via AdWords API and Google Ads API Forum


$url = 'https://adwords.google.com/api/adwords/cm/v201809'; at the top in the 
code



вторник, 10 декабря 2019 г., 20:52:18 UTC+3 пользователь Василий Рогачев 
написал:
>
>
> Good afternoon!
>
> First time working with the Adwords API. Before that, I worked with 
> Google's Contats API and there were no problems. And here I do not quite 
> understand why the request is not fulfilled?
>
> The program code in php below. An example of a query took 
> https://developers.google.com/adwords/api/docs/guides/reporting . But I 
> do not quite understand why there is no refresh token in the request ?
>
> *502.* That’s an error.
>
> The server encountered a temporary error and could not complete your 
> request.
>
>  $params1='{
>"reportDefinition": {
>"selector": {
>"fields": [
>"Campaign",
>"AdGroupId",
>"Impressions",
>"Clicks",
>"Cost"
>],
> "predicates": {
>"field": "AdGroupStatus",
>"operator": "IN",
>"values": [
>"ENABLED",
>"PAUSED"
>]
> }
>  },
>  "reportName": "Custom Adgroup Performance Report",
>  "reportType": "ADGROUP_PERFORMANCE_REPORT",
>  "dateRangeType": "LAST_7_DAYS",
>  "downloadFormat": "CSV",
>  "_xmlns": "https://adwords.google.com/api/adwords/cm/v201809;
>   }
> }';
> // Converts the input parameters of the query in JSON format
> $body = $params1;
>
> //print_r($body);
> //echo "___";
>
>
> // Creating HTTP request headers
>
>
>
> $headers = array(
>"Host: adwords.google.com",
>"User-Agent: curl, gzip",
>"Accept: /",
>"Accept-Encoding: gzip",
>"Authorization: Bearer ya29..g",
>"developerToken:NBQ",
>"clientCustomerId:124...li.apps.googleusercontent.com",
>"Content-Length: 784",
>"Expect: 100-continue",
>"Content-Type: multipart/form-data; 
> boundary=12d01fae60c7b559",
> );
>
>
>
>
>
>
>
> echo " < br>Adwords Report";
>
> // Curl initialization
> $curl = curl_init();
> curl_setopt($curl, CURLOPT_URL, $url);
> curl_setopt($curl, CURLOPT_POST, true);
> curl_setopt($curl, CURLOPT_POSTFIELDS, $body);
>
> /*
> To fully use the https Protocol, you can enable SSL certificate 
> verification of the direct API server.
> To enable validation, set the CURLOPT_SSL_VERIFYPEER option to true, and 
> uncomment the string with the CURLOPT_CAINFO option and specify the path to 
> the local copy of the root SSL certificate.
> */
> curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
> // curl_setopt($curl, CURLOPT_CAINFO, getcwd().'\CA.pem');
>
> curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
> curl_setopt($curl, CURLOPT_HEADER, true);
> curl_setopt($curl, CURLINFO_HEADER_OUT, true);
> curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
>
> // - - - Run a loop to execute queries ---
> // If HTTP code 200 is received, the report content is displayed
> // If HTTP code 201 or 202 is received, repeated requests are made
> while (true) {
>
> $result = curl_exec($curl);
>
> if (!$result) {
>
> echo ('curl error:'.curl_errno($curl).'- ' .curl_error($curl));
>
> break;
>
> } else {
>
> // Separation of HTTP headers and the response body
>$responseHeadersSize = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
>$responseHeaders = substr($result, 0, $responseHeadersSize);
>$responseBody = substr($result, $responseHeadersSize);
>
> // Get HTTP status code
>$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
>
> // Retrieving HTTP response headers
>// Request ID
>$requestId = preg_match('/RequestId: (\d+)/', $responseHeaders, 
> $arr)? $arr[1]: false;
>// Recommended interval in seconds to check if the report is ready
>$retryIn = preg_match('/retryIn: (\d+)/', $responseHeaders, $arr)? 
> $arr[1]: 60;
>
> if ($httpCode == 400) {
>
> echo " the query Parameters are incorrect or the limit of 
> reports in the queue has been reached";
>echo " RequestId: {$requestId}";
>echo " JSON request code:{$body}";
>echo " server response JSON:{$responseBody}";
>
> break;
>
> } elseif ($httpCode == 200) {
>
> echo " Report created successfully";
>echo " RequestId: {$requestId}";
>echo $responseBody;
>
> break;
>
> } elseif ($httpCode == 201) {
>
> echo "the Report was successfully queued in offline mode";
>echo " resend request after {$retryIn} seconds";
>echo " RequestId: {$requestId}";
>
> sleep($retryIn);
>
> } elseif ($httpCode == 202) {
>
> echo " the Report is generated offline.";
>echo " resend request after