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.
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.
@Anwar: If either of the two people have their Friends visible to you then you will see them in Mutual Friends. Only if both of them have their Friends hidden then you won't see them.
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
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With