Getting 404 after a users lookup


#1

Sometimes I get 404 error. Case is like this:

I make “1.1/users/lookup” for only 1 user and the response comes as 404.
For example when I get the following ids of the user id: 392225691 I get nearly 400 results.
When I get data for his friends I get data well. But the list includes this user id: 296220554
When I try to get data for this user I get 404 error.

Is it normal to see a 404, for a user is already in friends ids list?
Thank you


#2

It seem like in this case I get a 404 because of a suspended user account.


#3

404 for suspended users is new behavior? It didn’t work this way in version 1.

Also, documentation indicates otherwise:

https://dev.twitter.com/docs/api/1.1/get/users/lookup

“If a requested user is unknown, suspended, or deleted, then that user will not be returned in the results list.”

Ideas?


#4

I’ll look into why this is the case with 1.1.


#5

Actually, thinking about it – 404 is the correct response if the only IDs you’re looking up are users that cannot be returned. Are you getting a 404 when any of your criterion match a suspended user? This appears to be functioning as expected.


#6

Taylor…it didn’t work this way in version 1.

https://api.twitter.com/1.1/users/lookup.json?user_id=40655442,20546508,9764082

Is this how it will start working? If all users are suspended then we get a 404?


#7

In fact, these same users returned an empty list in version 1 which matches the docs…


#8

Yes, API v1.1 is a new API and users/lookup has been reimplemented. If a request cannot be satisfied due to having no results, a 404 in this case is the appropriate response. I’ll update the documentation to make that clearer. If you provide multiple criteria and one or more of those criteria will result in a response, you’ll get collection back omitting that which could not be serviced.


#9

Appreciate it. I’ve added support for handling the 404 in this case. Thanks!


#10

I’m sorry but I’m confused.

If a requested user is unknown, suspended, or deleted, then that user will not be returned >> in the results list.
But (beside the active users) I get suspended users inside the result of users/lookup??
Is it normal to have suspended IDs inside lookup result.


#11

each time i make this request, the result omit the last id from imput… why?

the problem is not that last id is unknown because i can alter order and get same response

thanks.


#12

I think proper response in such case should be an empty list, not some kind of error that will need to be handled in try…except clause.