Ceasar
Ceasar

Reputation: 23073

How to get Mutual Friends via Facebook's Graph API

Is there anyway to get a list of mutual friends using Facebook's Graph API?

I've been playing around with this tool and haven't yet figured out a way. However, I saw Simon's demo on Facebook's site, and it sounded like he was able to get the mutual likes of friend of his (it was too blurry to see how he did it so) so I feel like I ought to be able to, but I can't find any documentation besides some php scripts.

Upvotes: 7

Views: 18742

Answers (3)

khammami
khammami

Reputation: 371

The Mutual Friends API was deprecated on April 4, 2018, and the endpoints below started returning empty data sets. The endpoints are now fully deprecated and will return an error. https://developers.facebook.com/docs/graph-api/changelog/version3.1#mutual-friends-api

You can use this one to get mutuals friends from the graph

https://developers.facebook.com/tools/explorer/?method=GET&path=me%2Fmutualfriends%2F1207059

Upvotes: 12

bkaid
bkaid

Reputation: 52073

I would do this as a FQL query and test it with their FQL tester. This might not be 100% what you are looking for, but it should be enough to get you started:

   SELECT uid1, uid2 FROM friend 
   WHERE uid1 IN 
   (SELECT uid2 FROM friend WHERE uid1=me())
   AND uid2 IN 
   (SELECT uid2 FROM friend WHERE uid1=me())

You could then look up these id's up against the user table.

Upvotes: 1

CSSHell
CSSHell

Reputation: 103

Goto the API Documentation page here:

http://developers.facebook.com/docs/reference/api/

Mid-way down the page you will see:

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

You'll need to replace the /me/ with a valid ID of the person you are looking for and you;ll need to get the access_token as well.

Hope this starts you in the right direction..

EDIT: There is also this which may be easier:

http://developers.facebook.com/docs/reference/rest/friends.getMutualFriends/

Legacy REST method

Upvotes: 1

Related Questions