Twitter ADs API spend Failures

api

#1

API
Twitter spend API failure
Advertiser API
1 / 8

Hey folks,

I am kishore who works for uber adtech team. Nice to meet you!

Today we had some API failures of pulling 15th october ads spend data on twitter for account “18ce54h9509”. This is brazil account, since brazil timezone switch (15th Oct) we are getting this problem.

Can you help fix this issue as soon as possible?

Specifically, our request was rejected when we tried to call this API:

=====================CODE=========================
Request(client, ‘post’, ‘/1/stats/jobs/accounts/18ce53ywppc’, {‘placement’: ‘ALL_ON_TWITTER’, ‘metric_groups’: ‘ENGAGEMENT,WEB_CONVERSION,MOBILE_CONVERSION,MEDIA,VIDEO,BILLING,LIFE_TIME_VALUE_MOBILE_CONVERSION’, ‘start_time’: ‘2017-10-15’, ‘entity’: ‘CAMPAIGN’, ‘end_time’: ‘2016-10-17’, ‘granularity’: ‘DAY’, ‘entity_ids’: u’7zlc1’, u’7zlc8’, u’854ts’,u’858b9’, u’858ba’, u’858bb’, u’858bc’, u’858bd’, u’858be’,u’858bf’, u’858bg’, u’858bh’, u’858bi’, u’858bj’, u’85wgb’,u’85wgc’, u’85wgd’, u’85wge’, u’85wgf’, u’85wgg’}

Error message: Expect time to be midnight in the account’s local timezone for day granularity

Earlier we had same problem (Twitter spend API failure). At that time its been suggested that not to use offset. We have implemented this, but still getting same error. Could you please check this.


#2

@juanshishido can you please help


#3

Thanks for the question, @kishore_uber. Nice to meet you, too.

We’ve been able to repro this (with a slightly modified request):

$ twurl -H ads-api.twitter.com "/2/stats/accounts/18ce54h9509?placement=ALL_ON_TWITTER&metric_groups=ENGAGEMENT&start_time=2017-10-15T03:00:00Z&end_time=2017-10-16T02:00:00Z&granularity=DAY&entity=CAMPAIGN&entity_ids=9nb5s"
{
  "errors": [
    {
      "code": "INVALID_TIME_WINDOW",
      "message": "Expect time to be midnight in the account's local timezone for day granularity",
      "parameter": ""
    }
  ],
  "request": {
    "params": {
      "start_time": "2017-10-15T03:00:00Z",
      "entity_ids": [
        "9nb5s"
      ],
      "end_time": "2017-10-16T02:00:00Z",
      "placement": "ALL_ON_TWITTER",
      "account_id": "18ce54h9509",
      "granularity": "DAY",
      "entity": "CAMPAIGN",
      "metric_groups": [
        "ENGAGEMENT"
      ]
    }
  }
}

It looks like there is an issue with the way we check for midnight in the account’s local timezone.

As a workaround, please request data at hour granularity (granularity=HOUR). This is the same exact request, but with a different granularity value:

$ twurl -H ads-api.twitter.com "/2/stats/accounts/18ce54h9509?placement=ALL_ON_TWITTER&metric_groups=ENGAGEMENT&start_time=2017-10-15T03:00:00Z&end_time=2017-10-16T02:00:00Z&granularity=HOUR&entity=CAMPAIGN&entity_ids=9nb5s"
{
  "data_type": "stats",
  "time_series_length": 23,
  "data": [
    {
      "id": "9nb5s",
      "id_data": [
        {
          "segment": null,
          "metrics": {
            "impressions": [30,15,13,3,2,1,2,11,5,47,84,84,64,77,55,83,74,67,51,60,69,38,66],
            "tweets_send": null,
            "qualified_impressions": null,
            "follows": null,
            "app_clicks": [1,1,0,0,0,0,0,0,0,0,0,0,1,1,2,0,0,0,0,0,0,0,0],
            "retweets": null,
            "likes": null,
            "engagements": [1,1,0,3,0,0,0,0,0,0,1,1,4,2,3,0,0,1,0,1,0,0,0],
            "clicks": [0,0,0,3,0,0,0,0,0,0,1,1,3,1,1,0,0,1,0,1,0,0,0],
            "card_engagements": [1,1,0,0,0,0,0,0,0,0,0,0,1,1,2,0,0,0,0,0,0,0,0],
            "poll_card_vote": null,
            "replies": null,
            "url_clicks": null,
            "carousel_swipes": null
          }
        }
      ]
    }
  ],
  "request": {
    "params": {
      "start_time": "2017-10-15T03:00:00Z",
      "segmentation_type": null,
      "entity_ids": [
        "9nb5s"
      ],
      "end_time": "2017-10-16T02:00:00Z",
      "country": null,
      "placement": "ALL_ON_TWITTER",
      "granularity": "HOUR",
      "entity": "CAMPAIGN",
      "platform": null,
      "metric_groups": [
        "ENGAGEMENT"
      ]
    }
  }
}

We’ll add this to our backlog, but can’t provide an estimate as to when it might be fixed.


Expected start_time to be precisely aligned at midnight in timezone America\/Santiago for granularity Some(DAY), got \"2016-05-15T03:00:00Z\" for
Expected start_time to be precisely aligned at midnight in timezone America\/Santiago for granularity Some(DAY), got \"2016-05-15T03:00:00Z\" for