Does facebook have an api for searching a user's friend?
Tim
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)
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
Related
I am using facebook FQL to get the friends list
I am using this query
"select uid, name, pic_square, is_app_user from user where uid in (select uid2 from friend where uid1 = me())";SELECT uid, name, is_app_user, pic_square FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND is_app_user = 1"
Its working fine but it returns me only few friends like 15 to 20
I need all my friends in responce
Any idae?
Thanks
I guess you're using v2.0 of the Graph API. Therefore, you only get the friends which also use the app of which the requesting user access token was issued
See https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids
If your app was set up before April 30th 2014, you can specify that you explicitly want to use v1.0, which will give you all friends. This will only work until April 30th, 2015. If the app was created later, there's no possibility to get all friends.
Is it possible to get all liked movie pages via FQL?
The most stable way currently to get the names of the pages not necessarily the ids would be to run a query on the user table. page_fan returns little to no results even though the user may have numerous pages likes of type Movie.
SELECT movies from user where uid=me() and movies != ''
or for all friends
SELECT movies from user where uid in (SELECT uid2 FROM friend WHERE uid1 = me()) and movies != ''
There is currently no way to get all like movie pages of a user (in terms of ids) via FQL.
Update: I jumped the gun.
This should work
SELECT name, page_id from page where page_id in (SELECT page_id from page_fan where uid in (SELECT uid2 FROM friend WHERE uid1 = me()) and profile_section='movies')
Though it's still unstable and doesn't return all matches >.<
Yes it is. Check out the Graph API Explorer. You can run FQL statements on the page_fan table from there. You'll need to require the user_likes permission and then parse out the movie entries. that field is not index.
yes, just query the FQL page_fan table http://developers.facebook.com/docs/reference/fql/page_fan/ with the correct permissions.
I try to find facebook api to retrieve user's friends who like the same fan page but I dont think the new graph api able to do this.
While searching in the stackoverflow, I came out with this FQL:
select user_id from like where object_id = "[page_id]" and user_id in (select uid2 from friend where uid1 = me())
but facebook return me with
array(0) {
}
is there any solution ?
You can do this with FQL:
SELECT uid FROM page_fan
WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
AND page_id = "[fan_page_id]"
Which returns you friends who are fans of given fan page ([fan_page_id]). It works at this moment quite well.
Is there any fql statements allowed by facebook that helps to fetch contents of this page through an application interface: http://www.facebook.com/posted.php I know the links table returns the posted item for a logged in user (http://developers.facebook.com/docs/reference/fql/links). I need the same but for the logged-in user's friends.
Thanks.
you can use Fql query or Graph API to get your friends data.
Sometimes you will not get all information from the graph like birthdate of your friends but yes you can use fql queries to solve your probs.
here is an exmple for you.
create first facbook object and the use it.
$query = "SELECT uid, first_name, last_name, birthday_date, sex, pic_square, current_location, hometown_location FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND birthday_date != 0 ORDER BY birthday_date";
Regards,
Archit.
You can do this through an FQL query - though you may need to use multiple queries if you require more information about the friend who posted the link:
select title, owner from link where owner in (select uid2 from friend where uid1 = me() limit 100)
You may want to limit the number of friends (or even the links themselves) as this can be a costly query
When a user logs in to my facebook application, i want to show him a list of all of his friends that has my application installed.
can I use FQL to query who's of his friends have my application installed? and if so how ?
thanks!
Actually, you can do pull list of friends who installed an app through FQL.
SELECT uid, name, pic_square FROM user WHERE is_app_user AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me())
You can do it like this also, if is_app_user=1 then its app user.
NSString *query =
#"SELECT uid, name, pic_square,is_app_user FROM user WHERE uid IN "
#"(SELECT uid2 FROM friend WHERE uid1 = me() LIMIT 25)";