Reputation: 89
I'm looking into the Adwords API and I'm having trouble to find how to get reports without parsing them after downloading.
I spent significant amount of time but the only real option for getting keywords data between dates is with reports, but looks like you have to download and then parse them, am I right?
Thanks in advance
Upvotes: 2
Views: 248
Reputation: 2167
I am pretty sure there isn't a way to access reports in a true "API" manner, you're basically stuck parsing a CSV. One trick though, is that now you can at least get the response as string, rather than writing/reading from the local filesystem with:
$response = $reportDownloadResult->getAsString();
Upvotes: 0
Reputation: 89
If anyone is still interested in the solution, I maybe haven't made clear enough, my goal was to get the date without downloading the files, I wanted to get as an object and insert into local database.
At the end I got it in xml format and used XPATH or something similar.
I haven't found a way to get as response reports as objects.
Upvotes: 0
Reputation: 76
Set download format to csv so you will get the output file in the CSV format.
ReportDefinition reportDefinition = new ReportDefinition();
reportDefinition.setReportName("Criteria performance report #" + System.currentTimeMillis());
reportDefinition.setDateRangeType(ReportDefinitionDateRangeType.YESTERDAY);
reportDefinition.setReportType(ReportDefinitionReportType.CRITERIA_PERFORMANCE_REPORT);
reportDefinition.setDownloadFormat(DownloadFormat.CSV);
ReportDownloadResponse response =
new ReportDownloader(session).downloadReport(reportDefinition);
response.saveToFile(reportFileName);
Upvotes: 1