v1 Stats returns null metrics for large entity_id lists



Using the v1 stats API, I notice sometimes null is returned for metrics such as impressions, clicks, engagements when there are more than 5 entity_ids. For example, the query below contains 20 entity_ids and returns null impressions for entity_id nquf7 :

twurl -t -H ads-api.twitter.com ‘/1/stats/accounts/5lwgvc?metric_groups=ENGAGEMENT,BILLING,MOBILE_CONVERSION&placement=ALL_ON_TWITTER&granularity=HOUR&start_time=2016-03-31T00:00:00-07:00Z&end_time=2016-04-03T22:00:00-07:00Z&entity=PROMOTED_TWEET&entity_ids=nqoh4,nquf7,nr18q,oaeg4,oaeg5,oaeg6,oaeg7,oeaol,oeaom,owvhe,ox2cp,ox2cq,ox2cr,ox2cs,p43ky,p43kz,p43l0,p43l1,pj5ib,pjf3k’

However, the similar query below only contains 5 entity_ids and returns valid impression counts for entity_id nquf7:

twurl -t -H ads-api.twitter.com ‘/1/stats/accounts/5lwgvc?metric_groups=ENGAGEMENT,BILLING,MOBILE_CONVERSION&placement=ALL_ON_TWITTER&granularity=HOUR&start_time=2016-03-31T00:00:00-07:00Z&end_time=2016-04-03T22:00:00-07:00Z&entity=PROMOTED_TWEET&entity_ids=nqoh4,nquf7,nr18q,oaeg4,oaeg5’

Is the maximum for entity_ids really 20 or is it lower? This happens using both synchronous and asynchronous stats endpoints.



Thanks for reporting this issue - in general I would recommend to call the synchronous endpoint with less entity_ids especially if you are retrieving multiple metric groups at the same time. Maintaining a low cost for each individual stats request would be key for keeping a smooth chain of requests and reducing errors.

However this particular case is definitely a bug and appreciate you highlighting it to us.




Just to update here, the bug for this issue was identified and waiting to deploy fix in next regular deployment (probably within the next 2 days).




Great, thanks up the update.


Closing out this thread as the issue was confirmed to be resolved as of today, please post a new thread if you see anything else!