googleads / googleads-dfa-reporting-samples

Samples for the DoubleClick for Advertisers Reporting and Trafficking API
Apache License 2.0
106 stars 173 forks source link

Fix Invalid value for Enddate. #29

Closed leoprince closed 4 years ago

leoprince commented 4 years ago

Running this code gave, "code" : 400, "errors" : [ { "domain" : "global", "message" : "Invalid value for: Invalid format: \"2020-05-11\" is too short", "reason" : "invalid" } ], "message" : "Invalid value for: Invalid format: \"2020-05-11\" is too short" }

Talking to google Team(Sang) it seemed, It appears that the Campaign end date is a date only however the Ad end date requires the date and time to end. Hence the error message is saying its too short as it is missing the time component i.e. its expecting a format like 2020-05-11T16:00:00.000-08:00

You can confirm that the Campaign end date is a date only with the following: campaign.getEndDate().isDateOnly() which should return true.

To get your sample code working you can replace your line 75 from:

DateTime endDate = campaign.getEndDate();

to

DateTime endDate = new DateTime(campaign.getEndDate().getValue());
googlebot commented 4 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.