Determining if two app using users have any mutual friends in Graph API 2.0/2.1?

北城余情 提交于 2019-12-11 11:28:25

问题


I want to determine if two users (both using my app) have any mutual friends in common. The names/data of the users are irrelevant, the number of the mutual friends is irrelevant. I just need if two people have any friends on Facebook in common or not. The mutual friends may not be using the app, but the two ends ARE using my app. These were pretty easy in Graph API 1.0, but I'm wondering if what I'm trying to achieve is possible by any means in Graph API 2.0 or 2.1?


回答1:


Use the mutual_friends API. How to use it is explained at https://developers.facebook.com/docs/graph-api/reference/v2.1/user.context/mutual_friends




回答2:


Sorry to say, user A & B have to be friends if you want to use

/v.2.2/{user-id}?fields=context.fields(mutual_friends)

to check their mutual friends (e.g. C,D,E,F...)

I had double checked as @WizKid said, with the following sample:

1. A & B are friends, run the mutual_friends Graph API call ===> Found
2. unfriend A & B, run the same mutual_friends Graph API call ===> No data
3. Be-friended A & B again, run same Graph API call ===> Found


来源:https://stackoverflow.com/questions/26592509/determining-if-two-app-using-users-have-any-mutual-friends-in-graph-api-2-0-2-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!