Problem Stats V1 Granularity DAY



I’m trying to migrate our application to Ads API v1 and we use v0 stats endpoint to retrieve all statistics from a line_item starting 3 days ago and ending at actual time.

Adapting our app to the new v1 we realized that you need to put END TIME setted at midnight but you can’t and before actual time, so with granularity DAY you can’t reach until today.

Following Partner Inbounds

twurl -H '/1/stats/accounts/18ce54alb6p?start_time=2016-03-31T22:00:00Z&granularity=DAY&entity=LINE_ITEM&metric_groups=ENGAGEMENT&placement=ALL_ON_TWITTER&entity_ids=4pwbd&end_time=2016-04-04T22:00:00Z' | json

{ "errors": [ { "code": "INVALID_PARAMETER", "message": "Expected time before 2016-04-04T16:31:01Z, got \"2016-04-04 22:00:00 +0000\" for end_time", "parameter": "end_time" } ], "request": { "params": { "account_id": "18ce54alb6p", "end_time": "2016-04-04T22:00:00Z", "entity": "LINE_ITEM", "entity_ids": [ "4pwbd" ], "granularity": "DAY", "metric_groups": [ "ENGAGEMENT" ], "placement": "ALL_ON_TWITTER", "start_time": "2016-03-31T22:00:00Z" } } }
Results as with v0 ads API.

Also, if I try with an our before time as errors say, I get that end_time should be aligned with midnight.

Thanks for your time

v1 stats end_time cannot be in the future

Hey Hector,

If I’m reading this correctly, you’d like to retrieve stats for the current day with DAY granularity, but essentially are not able to, because of the validation rule which requires end_time to be at midnight of the current day, and that is also not a valid value, is that correct?

As you likely already know, you can still fetch the current day’s status using HOUR granularity for the request, but this is definitely something we’ll think over internally.



Hi Helen,

That’s exactly what I mean! :smiley:

Yes, as you say I know you can fetch current day’s status using HOUR granularity, but It’ll be usefull if I can do only one request instead of two, as I was doing with v0