INVALID_TIME_WINDOW Response

api

#1

Hi,
I want to take campaign stats on python with this request:

**GET **
https://ads-api.twitter.com/1/stats/accounts/98spr?entity_ids=43gk6&entity=CAMPAIGN&start_time=2016-10-28&end_time=2016-10-30&granularity=DAY&metric_groups=ENGAGEMENT,BILLING,WEB_CONVERSION,MOBILE_CONVERSION,VIDEO&placement=ALL_ON_TWITTER

I get INVALID_TIME_WINDOW error when using day granularity with date range from 2016-10-28 to 2016-10-31. Response here:

[{u’message’: u’Time cannot be fractional hours’, u’code’: u’INVALID_TIME_WINDOW’, u’parameter’: u’end_time’}, {u’message’: u"Expect time to be midnight in the account’s local timezone for day granularity", u’code’: u’INVALID_TIME_WINDOW’, u’parameter’: u’’}]

Such as date range from 2016-10-01 to 2016-10-20 i able to get stats. What is the cause of the situation?
Thanks.


#2

You should consider your hour gap between UTC in order to define midnight time


#3

@Altug_Yigit: We’re able to make a successful request for 98spr with the information you provided, even though there is no data (all null values). (It looks like this campaign ended on 2016-02-08T03:00:00Z, which would explain the response.)

What is different between the requests you’ve made earlier in October and now? The error message suggests that an incorrect time is being passed in. Could you share the actual start and end time values (not just the date)?


#4

Actually my account id is different from in request. I tried start time and end time as 2016-10-28T21:00:00Z and 2016-10-30T21:00:00Z problem was solved, thanks for your advice.


#5

@Altug_Yigit: Great to hear! Please consider marking this thread as solved.