Reporting API usage

130 views
Skip to first unread message

Peter Petrov

unread,
Apr 29, 2021, 9:33:33 AM4/29/21
to AdWords API and Google Ads API Forum
I am looking at the "new" (new for me) Google Ads API v6.
I am working with the Java client lib version 10.1.0.  

My job is to get reports... e.g. a campaign performance report. 
Currently I am using the old AdWords API to get reports. 

In fact currently I am not using any API objects, I just http POST to this URL 


I mean, I post an XML report definition, and I get immediately data back either in XML or in CSV format. Of course I send there also the necessary headers etc. 

Now... In the Google Ads API v6, I understand that there's no XML report definitions any more. First of all, is that indeed so? My understanding is that they are replaced by a SQL-like format/syntax.

OK, using this SQL-like syntax and a GoogleAdsClient object I was able to pull some reporting data. But if possible I prefer not to use any API objects. I just want to http POST to some URL (sending the proper headers and payload) just like I did before and get textual data back in XML or in CSV format. So basically I want to do lower-level communication to avoid all the overhead of serializing/de-serializing API objects, calling getters on them, etc., etc. 

Is that still possible? 

Many thanks in advance. 







Google Ads API Forum Advisor Prod

unread,
Apr 29, 2021, 3:24:53 PM4/29/21
to p.a.p...@gmail.com, adwor...@googlegroups.com

Hi Peter,

Thank you for reaching out. Using the client library is not required. You could make API calls by utilizing cURL instead. Please refer to this guide on how to send a request via cURL and how to construct the API request.

Thanks and regards,
Xiaoming, Google Ads API Team

 

Google Logo
Xiaoming
Google Ads API Team
 


ref:_00D1U1174p._5004Q2GIcDn:ref

Peter Petrov

unread,
Apr 30, 2021, 5:58:44 AM4/30/21
to AdWords API and Google Ads API Forum
OK, thank you. 

So this guide is about the REST API.

1) So I guess this means I will probably get the results back in JSON format, right?  
No option to get back XML or CSV (as in the old API), right? 

In the old API the format was being controlled by a field passed in with the report definition. 
<downloadFormat>CSV</downloadFormat>
<downloadFormat>XML</downloadFormat>
And that report definition was part of the body sent with the POST request. 


2) Are the 4 headers given in the example the only headers one could pass in? 

--header "Content-Type: application/json"  
--header "developer-token: ${DEVELOPER_TOKEN}"  
--header "login-customer-id: ${MANAGER_CUSTOMER_ID}"  
--header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}"  


Are these any additional headers one could pass in? 


3) I am asking the previous question because the old API had headers like  

             skipReportHeader 
             skipReportSummary 
             clientCustomerId 

These are not there anymore, correct? 


4) Btw, I have troubles to call this HTTPs endpoint/URL 


but I will keep investigating. The error is not very informative - just HTTP code 400. 
I am passing in the 4 headers mentioned above so I am not sure what I am doing wrong. 
Any ideas? 








Peter Petrov

unread,
Apr 30, 2021, 6:02:21 AM4/30/21
to AdWords API and Google Ads API Forum
5) Also the Linux manual of curl says that when we specify --data 
the content type that curl will send to the server will be 
x-www-form- urlencoded
But your example explicitly specifies application/json
I don't quite get this. 

Again... many thanks in advance. 




Google Ads API Forum Advisor Prod

unread,
Apr 30, 2021, 3:07:24 PM4/30/21
to p.a.p...@gmail.com, adwor...@googlegroups.com

Hi Peter,

Thank you for reaching out. Please find my response to your questions below:
 

  1. You are right. You will get the JSON as the returned value. It does not provide the XML or CSV format. You would need to convert them yourself if needed.
 
  1. There aren’t other headers needed to make the API call.
 
  1. These are not there anymore. The clientCustomerId is already specified in the request URL.
 
  1. You might not send the request with complete data required. Please make sure that the request headers and body are correctly configured and constructed with necessary data. If the issue persists, please share the complete request and response logs along with the full cURL code snippet for us via the Reply privately to author option to further investigate.
 
  1. application/json is specified format for the request which the server could accept. It is supported by the Google Ads API.

Peter Petrov

unread,
May 4, 2021, 6:05:03 AM5/4/21
to AdWords API and Google Ads API Forum
Thank you. I got it working. 

I am able to pull the report now. 
Reply all
Reply to author
Forward
0 new messages