INVALID_TIME_WINDOW when there is no data in time range


This works:
twurl "/1/stats/accounts/faici?entity_ids=faici&entity=ACCOUNT&start_time=2016-03-02T05:00:00Z&end_time=2016-03-08T05:00:00Z&granularity=DAY&metric_groups=ENGAGEMENT&placement=ALL_ON_TWITTER" -t -H /0/accounts | python -m json.tool

This does not
twurl "/1/stats/accounts/faici?entity_ids=faici&entity=ACCOUNT&start_time=2016-03-09T05:00:00Z&end_time=2016-03-15T05:00:00Z&granularity=DAY&metric_groups=ENGAGEMENT&placement=ALL_ON_TWITTER" -t -H /0/accounts | python -m json.tool

I don’t know if the issue is related to the fact that there is no metrics in the 2016-03-09 to 2016-03-15 windows. I was expecting the data to return zero for that window, and not an INVALID_TIME_WINDOW error. I have tried reducing the time frame (i.e 2016-03-09 to 2016-03-14). Same issue.

cc @JBabichJapan … thanks


That’s because in the second time window there was the winter to summer change and in order to be aligned to midnight you should change the time offset.



ah!.. looks like it’s better to use date simply in yyyy-MM-dd (also ISO 8601) format to avoid having to deal with this. That way, the timezone offset is automatic.

This works fine:
twurl "/1/stats/accounts/faici?entity_ids=faici&entity=ACCOUNT&start_time=2016-03-09&end_time=2016-03-16&granularity=DAY&metric_groups=ENGAGEMENT&placement=ALL_ON_TWITTER" -t -H /0/accounts | python -m json.tool

thanks alot @hector_borras !