NetworkOperators returns next_cursor with value when there are no more results

ads
targeting

#1

Endpoint: https://dev.twitter.com/overview/api/tweetshttps://dev.twitter.com/ads/reference/get/targeting_criteria/network_operators

We have a task that retrieves the content of all the targeting_criteria/*, what this task does is to iterate over all the endpoint and gets 200 results per request. (I know we can retrieve 1000 per request, this is just the way we do it for technical reasons).

Here is the log of our task, as you can see, the last call doesn’t have results inside the data property, however that cursor was set in the previous request we made:

silly	: [Twitter Ads Targeting – NetworkOperators] Performing first request
debug	: [Twitter Ads Targeting – NetworkOperators]  » Saving 200 instances.
silly	: [Twitter Ads Targeting – NetworkOperators] Cursor Call Incomming (2). cursor: 9mxdk55xbdthjv0rt9lgzak9vk
debug	: [Twitter Ads Targeting – NetworkOperators]  » Saving 200 instances.
silly	: [Twitter Ads Targeting – NetworkOperators] Cursor Call Incomming (3). cursor: 417g8lyqi26pp16b1s1qrcamex4za7mxkl9h0tj1x3mfphaaz28
debug	: [Twitter Ads Targeting – NetworkOperators]  » Saving 200 instances.
silly	: [Twitter Ads Targeting – NetworkOperators] Cursor Call Incomming (4). cursor: 3ga1nukg6v3gkm0ao
warn	: [Twitter Ads Targeting – NetworkOperators] Nothing to save.
debug	: [Twitter Ads Targeting – NetworkOperators] Total cursors calls for NetworkOperators: 4.

The cursor 3ga1nukg6v3gkm0ao was set in the last but one request, however when we do a request for that cursor, there are no results inside the data property.

It should not return a value in next_cursor if there are no more results to get.

This only happens in the NetworkOperators endpoint, all the others work well.


#2

Hey @k4rliky

Thanks for brining this to our attention! I’ve been able to reproduce the issue, and it does look like this is a bug. However, given that this is not a major bug and a clear workaround is possible, i.e., to check for an empty data: [] object, note that this may take some time before we have any updates. We’ll definitely report back once we know more.

Thanks!