Searching Users Friends List



Is there a way to search a user’s friends? I’d like my app to allow the users to search their friends to select, instead of scrolling through 20 friends at a time loaded by a REST call friends/list. So, they could type in “foo”, and the request our app makes to the REST API would return, the users match it (say, “foobar” and “foobarred”).

Any advice or links would be greatly appreciated!



No, there’s no direct way to search through a list of followers.

Instead of using friends/list, I recommend using friends/ids and users/lookup together – much more efficient: [node:10362]


Thanks for the response @episod. I read the docs for using friends/ids and users/lookup. Were you saying there was a way to accomplish the search combining those two, or was it just a comment that in general those two together are betters calls to make than friends/list?

Again, much appreciated! :slight_smile:


Just that, in general, using friends/ids -> users/lookup is worlds more efficient than friends/list – friends/list is a simple convenience, most useful for the majority of users you’ll find who do not follow many. But if you want to do any serious work with the graph of a specific user, you’ll need to first fetch the IDs, then use users/lookup to “hydrate” those into user objects. Then you’ll have efficiently built a collection to perform searches on.


Thanks @episod - I will read through those and implement. As you might guess, I’m new to the Twitter API, so I appreciate all pointers.

Happy developing!


But isn’t the limit for friends/ids the same 15/15 minutes? I don’t see what that buys you.

Many thanks in advance for the response.