According to the documentation for the Favorites/list REST API endpoint, you’re allowed to ask for a maximum of 200 tweets using the count parameter.
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: https://api.twitter.com/1.1/favorites/list.json?count=200
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 id of the last tweet in the array response from the first request.
-
I use the id from step 1 as the max_id in the second request. The max_id specifies 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:
https://api.twitter.com/1.1/favorites/list.json?count=200&max_id=id_of_last_tweet_from_first_response
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?
UPDATE
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.