How to get Mutual Friends via Facebook's Graph API

前端 未结 3 1047
醉话见心
醉话见心 2021-02-09 12:55

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

相关标签:
3条回答
  • 2021-02-09 13:33

    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

    0 讨论(0)
  • 2021-02-09 13:35

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

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

    0 讨论(0)
  • 2021-02-09 13:42

    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.

    0 讨论(0)
提交回复
热议问题