I cannot set a custom date to campaign performance report in JAVA API

17 views
Skip to first unread message

killo...@naver.com

unread,
Mar 28, 2019, 6:37:12 AM3/28/19
to AdWords API and Google Ads API Forum

import com.google.api.ads.adwords.lib.jaxb.v201809.Selector;

import com.google.api.ads.adwords.lib.jaxb.v201809.DateRange;

import com.google.api.ads.adwords.lib.jaxb.v201809.ReportDefinition;

import com.google.api.ads.adwords.lib.jaxb.v201809.ReportDefinitionDateRangeType;

import com.google.api.ads.adwords.lib.jaxb.v201809.ReportDefinitionReportType;

import com.google.api.ads.adwords.lib.jaxb.v201809.DownloadFormat;


DateRange dateRange = new DateRange();


dateRange.setMin("20190326");

dateRange.setMax("20190326");


Selector selector = new Selector();


selector.setDateRange(dateRange);


ReportDefinition reportDefinition = new ReportDefinition();

reportDefinition.setReportName("my_report");

reportDefinition.setDateRangeType(ReportDefinitionDateRangeType.CUSTOM_DATE);

reportDefinition.setReportType(ReportDefinitionReportType.valueOf("CAMPAIGN_PERFORMANCE_REPORT");

reportDefinition.setDownloadFormat(DownloadFormat.CSV);




================================================================================



However, I received all the reports regardless custom date...


please solve this problem :(

googleadsapi...@google.com

unread,
Mar 28, 2019, 3:33:21 PM3/28/19
to AdWords API and Google Ads API Forum
Hello, 

Please find the code snippet below as a reference to set the CUSTOM_DATE. 

ReportQuery query = 
new ReportQuery.Builder() 
.fields( "CampaignId, CampaignName" ) 
.from(ReportDefinitionReportType.CAMPAIGN_PERFORMANCE_REPORT) 
.during(ReportDefinitionDateRangeType.CUSTOM_DATE) 
.during(new LocalDate(2018, 11, 18), new LocalDate(2018, 11, 18)) 
.build();

Could you please give it a try? If you're still facing an issue, please get back to us with the code snippet you're trying and the error you're receiving.

Regards,
Bharani, Google Ads API Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    http://googleadsdeveloper.blogspot.com/search/label/adwords_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

Reply all
Reply to author
Forward
0 new messages