for some ads I recieve duplicate rows, all the data is exactly the same. In order to investigate the issue, I have removed the field I request, one by one and came to realize that Date field is causing the problem, without it the data is received fine
Selector selector = new Selector();
//set fields
selector.getFields().addAll(Lists.newArrayList(
"AccountCurrencyCode",
"AdGroupId",
"AdType",
"AveragePageviews",
"AveragePosition",
"CampaignId",
"Labels",
"Id",
"Clicks",
"Cost",
"CreativeDestinationUrl",
"CreativeFinalUrls",
"CreativeTrackingUrlTemplate",
"Date",
"DisplayUrl",
"Headline",
"Impressions"
));
//set dates
DateRange dateRange = new DateRange();
dateRange.setMin(startDate.toString());
dateRange.setMax(endDate.toString());
selector.setDateRange(dateRange);
// Create report definition.
ReportDefinition reportDefinition = new ReportDefinition();
reportDefinition.setReportName("Ad performance report #" + System.currentTimeMillis());
reportDefinition.setDateRangeType(ReportDefinitionDateRangeType.CUSTOM_DATE);
reportDefinition.setReportType(ReportDefinitionReportType.AD_PERFORMANCE_REPORT);
reportDefinition.setDownloadFormat(DownloadFormat.XML);
reportDefinition.setSelector(selector);
startDate and endDate are of type LocalDate
Any thing I am doing wrong?
Thanks
Nir