Can you tell me how to access campaign performance report its return object

44 views
Skip to first unread message

ntdm...@gmail.com

unread,
Nov 17, 2016, 9:40:07 AM11/17/16
to AdWords API Forum
Hi,
I have seen many forums where when accessing campaign_performance_report then are downoading the query result to a file(csv/txt..).

I would like to know using selector how can i access the campaign_performance_report and what is the class which can be used to access clicks, impressions etc instead of downloading.

Please let me know the sample code to fetch the details into an object instead of downloading.

Alan Coleman

unread,
Nov 17, 2016, 12:11:10 PM11/17/16
to AdWords API Forum
Hello,

The Supported Download Formats are explained in the documentation.

Do you mean returning the data and displaying in a browser rather than downloading a file?

Thanks

Shwetha Vastrad (AdWords API Team)

unread,
Nov 17, 2016, 2:15:29 PM11/17/16
to AdWords API Forum
Hi,

As Alan says, the only formats supported while downloading report are the ones listed here. If you are looking for a response similar to CampaignService, I'm afraid it's not possible when downloading reports. You could download the report in XML format and use a parser to read the required data. 

Regards,
Shwetha, AdWords API Team.  

ntdm...@gmail.com

unread,
Nov 21, 2016, 2:39:32 AM11/21/16
to AdWords API Forum
Hi Team,

I would like to use like a service for criteria_performance_report as i don't want to download i would like to return it to browser.Would like to kno how to use it with selector.Please provide an example.

Shwetha Vastrad (AdWords API Team)

unread,
Nov 21, 2016, 12:51:24 PM11/21/16
to AdWords API Forum
Hi,

In the Java client library, the ReportDownloadResponse is a holder class for http status and response body for a successful request. This object has the getAsString method, which returns the contents of the response as a String. It inflates the response if it is in one of the gzip formats. 

You can also access the InputStream via getInputStream method, and use this stream to display data in your application as needed. I'm afraid its not possible to download data in formats other than the ones listed here

ntdm...@gmail.com

unread,
Nov 22, 2016, 8:54:09 AM11/22/16
to AdWords API Forum
Can you provide some sample code

Shwetha Vastrad (AdWords API Team)

unread,
Nov 22, 2016, 1:15:16 PM11/22/16
to AdWords API Forum
Hi,

You can retrieve the InputStream and use the Guava I/O utilities to read the response from the InputStream as follows:

      ReportDownloadResponse response =
          new ReportDownloader(session).downloadReport(reportDefinition);
      
      CharSource source = new CharSource() {
        @Override
        public Reader openStream() throws IOException {
          return new InputStreamReader(response.getInputStream());
        }
      };
      ImmutableList<String> report = source.readLines();

You can use InputStream to store or display the contents as needed. 
Reply all
Reply to author
Forward
0 new messages