According to the documentation for the Favorites/list REST API endpoint, you’re allowed to ask for a maximum of 200 tweets using the
I have a user with over 1,000 favorited tweets. When I make the first request for the first 200 favorited tweets, I get back 200 tweets. EX:
Everything works fine up until this point. However, when I make a subsequent request and ask for the next 200 favorited tweets, twitter returns 199 tweets instead of 200. Looks like twitter is breaking their API contract.
The method by which I ask for the next 200 tweets in the second request is as follows:
I grab the
idof the last tweet in the array response from the first request.
I use the
idfrom step 1 as the
max_idin the second request. The
max_idspecifies that you want tweets that are older than or equal to the specified
id. This is an optional parameter that can be passed into the request.
Here’s what the second request looks like:
Because this user has over 1,000 favorited tweets, and the first request only grabbed the first 200, this second request should be returning the next 200 tweets. The actual behavior is that the twitter API is returning 199 tweets in the response.
I am testing this by using twitter’s OAuth Tool to create a CURL command with the appropriate OAuth signature, then piping the response to a
.json file. I’m then parsing the JSON and counting the number of tweets in the array.
Can anyone provide insight on this issue? How do we contact twitter about a potential bug in their API?
After further testing I’ve noticed that twitter sometimes also returns 199 tweets instead of 200 in the first response. When asking for 200 favorited tweets in the first request, even though there are well over 200 tweets.