Tim Shi
Tim Shi

Reputation: 123

searching friends using facebook graph api

Does facebook have an api for searching a user's friend?

Tim

Upvotes: 6

Views: 13897

Answers (2)

Ofir Hadad
Ofir Hadad

Reputation: 1900

You can search friend's name like this:

select uid, name, sex 
from user 
where uid in (SELECT uid2 FROM friend WHERE uid1 = me())
and (strpos(lower(name),'TheFriendName')>=0 OR strpos(name,'TheFriendName')>=0)

TheFriendName=Full name or part of the name

Example:

select uid, name, sex 
from user 
where uid in (SELECT uid2 FROM friend WHERE uid1 = me())
and (strpos(lower(name),'Jack')>=0 OR strpos(name,'Jack')>=0)

Upvotes: 6

rkg
rkg

Reputation: 5719

You can get the list of friends using the following API call:

Friends: https://graph.facebook.com/me/friends?access_token=...

and then search in the list for the person you are looking for.

Refer to more detailed documentation here: http://developers.facebook.com/docs/api

Upvotes: 3

Related Questions