Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

searching friends using facebook graph api

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

Tim

like image 968
Tim Shi Avatar asked Dec 17 '10 01:12

Tim Shi


People also ask

What data can I get from Facebook Graph API?

The Graph API is the primary way to get data into and out of the Facebook platform. It's an HTTP-based API that apps can use to programmatically query data, post new stories, manage ads, upload photos, and perform a wide variety of other tasks.

How do I use Facebook Graph API?

Go to Tools – Graph API Explorer to generate Access Tokens for various kinds of API that you would like to use in your app. Choose the app and kind of token you need in the drop down menus in the left part of the screen. Then click “Generate Access Token”.

Is Facebook Graph API deprecated?

Applies to all versions. Facebook Analytics will no longer be available after June 30, 2021. Additionally, we are deprecating the App Dashboard Plugin for Marketing API. For more information visit the Business Help Center.

Can I use Facebook API for free?

The Graph API is free to use, for all applicable use cases. Rate Limiting applies though, > developers.facebook.com/docs/graph-api/advanced/rate-limiting There is no way to “pay” or > otherwise get those limits raised for normal 3rd party apps.


2 Answers

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)
like image 105
Ofir Hadad Avatar answered Sep 28 '22 10:09

Ofir Hadad


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

like image 30
rkg Avatar answered Sep 28 '22 10:09

rkg