Facebook的图形API 2.2共同的朋友 [英] Facebook Graph API 2.2 mutual friends

查看:203
本文介绍了Facebook的图形API 2.2共同的朋友的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我一直想为这几天,试图找出如何使用Facebook的图形API V2.2让两个用户之间共同的朋友。我明白,我只能得到两个用户之间的相互朋友正在使用FB App和这很酷。

So I've been trying for this for a couple of days, trying to figure out how to use Facebook's Graph API v2.2 to get mutual friends between two users. I understand that I can only get the mutual friends between two users that are using the FB App and that's cool.

该应用程序有以下已批准项目:

The app has the following approved items:


  • 电子邮件

  • public_profile

  • user_birthday

  • user_friends

  • user_hometown

  • USER_LOCATION

  • user_relationships

  • user_website

我的情况是这样的:


  • 系统用户(A)注册到FB应用

  • 另一个用户(B)注册

  • 用户A着眼于用户B的配置文件

  • 配置文件应显示两个用户之间共同的朋友

我试过在图形API资源管理器玩

I've tried to play around in the Graph API Explorer

/v2.2/app_scoped_user_id?fields=context.fields%28mutual_friends%29


/v2.2/user_id?fields=context.fields%28mutual_friends%29
这些只是返回一个ID字段与我所提供的ID而不是其他。

/v2.2/app_scoped_user_id?fields=context.fields%28mutual_friends%29
and
/v2.2/user_id?fields=context.fields%28mutual_friends%29.
These just returns an ID field with the ID I provided and nothing else.

我全力以赴的想法,该文档是没有帮助,所以尽管。有人能解释如何做到这一点?
我将使用它在角应用程序,但只要我能得到的网址,以获取正确的事情,我可以把它翻译成JavaScript。

I'm all out ideas, and the docs isn't helping much either. Can someone explain how to do it? I will be using it in an Angular app but as long as I can get the URL to fetch the correct thing I can translate it into Javascript.

推荐答案

有关2.3版 - 的https://developers.facebook.com/docs/graph-api/reference/v2.3/user.context/mutual_friends

朋友之间要确保在查询中user_id是对方的朋友而不是当前用户的访问令牌您使用的是Facebook的ID。

Between friends make sure the user_id in the query is the Facebook id of the other friend not the current user whose access token you are using.

GET /v2.3/{other_user.user-id}?fields=context.fields%28mutual_friends%29

有关查询两个非朋友之间共同的朋友,你需要添加一台服务器appsecret_proof参数加上用户访问令牌。

For querying mutual friends between two non-friends you need to add a server appsecret_proof parameter plus the user access token.

这篇关于Facebook的图形API 2.2共同的朋友的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆