Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter Rest API: 404 No user matches for specified terms

Twitter allows up to 100 user ids at a time to query for user profile information. But if there is an invalid ID among those, it returns:

404 (Not Found), No user matches for specified terms

without specifying which is the bad ID and no data is returned for the rest of the users in the list. This happens if a user in the list closes their account.

Is there a way to identify the invalid ID without going through the list once again one by one (and possibly hitting the rate limit)?

like image 720
onurmatik Avatar asked Aug 27 '15 21:08

onurmatik


1 Answers

https://developer.twitter.com/en/docs/accounts-and-users/follow-search-get-users/api-reference/get-users-lookup.html

  • If a requested user is unknown, suspended, or deleted, then that user will not be returned in the results list.
  • If none of your lookup criteria can be satisfied by returning a user object, a HTTP 404 will be thrown.

From my understanding this means:

  • If you request 10 userIds and 1 of them is suspended, the request should still return 9 results
  • If you request 2 userIds and all of them are suspended, the request will return that error

I did a quick test and it seems to work as described. Could it be that all of the IDs in your request are invalid?

like image 105
patrickd Avatar answered Oct 21 '22 22:10

patrickd