使用Facebook API检索完整的朋友列表 [英] retrieve full list of friends using facebook API

查看:156
本文介绍了使用Facebook API检索完整的朋友列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

新的2.0版本有一个分页限制一个请求的朋友的数量,这不允许我立即检索所有的朋友,虽然有一个参数调用'限制',只能通过循环'offset ' 直到结束。问题是每个用户有不同的朋友数量!



我一直在寻找几个小时,但仍然没有解决方案..

解决方案

如Graph API v2.0升级指南( https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids


/ me / friends 返回还在使用您的应用的用户的朋友在
v2.0 中,朋友API端点返回列表一个人的朋友
谁也在使用你的应用程序
。在 v1.0 中,响应包括
个人的所有朋友



有两个应用程序需要访问非应用程序朋友的关键用例:
标记和邀请。在v2.0中,我们添加了可伸缩朋友API
邀请朋友API 来支持这些流。



一个人用Facebook登录的v2.0登录后,调用
/v1.0/me/friends和/ v2.0 / me / friends`将会导致v2。 0
行为 - 两个调用将返回该人的朋友的一组,
也使用该应用程序。


所以,在 v2.0 中,您只能通过 / me / taggable_friends 获得所有朋友 https://developers.facebook.com/docs/graph-api/reference/ v2.0 / user / taggable_friends )端点,它只包含字段 id name 图片,只有通过Facebook审查您的应用后才可以使用。


new 2.0 version has a paging that limit the numbers of friends at one request, which doesn't allow me to retrieve all friends at once although there's a parameter call 'limit', it can only be done by looping the 'offset' till the end. The problem is each user has different number of friends!

I've been looking around for few hours but still don't have a solution..

解决方案

As mentioned in the Graph API v2.0 upgrading guide (https://developers.facebook.com/docs/apps/upgrading#upgrading_v2_0_user_ids)

/me/friends returns the user's friends who are also using your app In v2.0, the friends API endpoint returns the list of a person's friends who are also using your app. In v1.0, the response included all of a person's friends.

There are two key use cases where apps need access to non-app friends: tagging and inviting. In v2.0, we've added the Taggable Friends API and the Invitable Friends API to support these flows.

After a person has logged in with v2.0 of Facebook Login, calling /v1.0/me/friends and/v2.0/me/friends` will both result in the v2.0 behaviour - both calls will return the set of the person's friends who also use the app.

So, in v2.0 you'll only be able to get all friends via the /me/taggable_friends (https://developers.facebook.com/docs/graph-api/reference/v2.0/user/taggable_friends) endpoint, which only contains the fields id, name, picture, and only can be used after a review of your app by Facebook.

这篇关于使用Facebook API检索完整的朋友列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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