Facebook“Friends.getAppUsers”使用图形API
我有一个应用程序,它使用旧的 REST API 调用 Friends.getAppUsers
来获取已授权我的应用程序的当前用户的好友列表。
我已阅读文档,如何使用 Graph API 执行此操作?这方面的例子是什么?
I have an application that uses the old REST API call Friends.getAppUsers
to get the list of friends for the current user that have authorized my application.
I have read the documentation, how do I do this with the Graph API? What would an example of this be?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
我搜索了一段时间,我也认为使用 Graph API 不可能做到这一点。
但是,我发布了一个类似的问题,替换旧的 GetAppUsers 调用以查看用户的使用我的应用程序的朋友?,对于我正在使用的特定 API,并得到了一个很好的通用答案。
或者更一般地说,
这将返回所有朋友,并为使用该应用程序的朋友添加附加字段“installed=true”。
这是它在 图表中的工作情况API 资源管理器:
I searched around for a while, and I too thought this wasn't possible using Graph API.
However, I posted a similar question, Replacement for old GetAppUsers call to see a user's friends who use my application?, for the specific API I was using and was given a great general answer.
or more generally
This returns all friends, with the additional field "installed=true" for those friends who use the application.
Here is it working in the Graph API Explorer:
这可以通过 FQL 来完成。
量子ED!
This can be done with FQL.
QED!
是的,Graph API 的文档记录得非常糟糕。我没有看到任何有关“应用程序”类型的文档,但他们确实有在文档中引用应用程序的信息:
https://graph.facebook.com/2439131959
所以,也许您可以使用 Group 语法获取应用程序的成员吗?
https://graph.facebook.com/2439131959/members
您需要经过身份验证的会话来测试它。否则,Facebook 似乎正在推动我们使用 FQL 直接发送查询:
http:// /developers.facebook.com/docs/reference/fql/application
因此,您可以传递 FQL 查询来获取有关您的应用程序的信息。
Yes, the Graph API is horribly documented. I don't see any documentation for an "application" type, but they do reference an application's info in the docs:
https://graph.facebook.com/2439131959
So, perhaps you can get the application's members using the Group syntax?
https://graph.facebook.com/2439131959/members
You'll need an authenticated session to test it. Otherwise, it looks like Facebook is pushing us to use FQL to send queries directly:
http://developers.facebook.com/docs/reference/fql/application
So you can pass a FQL query to get information about your application.
旧的 REST API:
新的图形 API:
Old REST API:
New Graph API:
我对这个问题做了很多调查。据我所知,无法使用 Graph API 执行
Friends.getAppUsers
。 Facebook 提供的最新 SDK 都使用旧的 REST API 来让好友使用该应用程序。I've done a lot of investigations on this issue. From what I can tell, there is no way to do
Friends.getAppUsers
using Graph API. The latest SDKs provided by Facebook all use the old REST API to get friends using the application.使用 restFB,我执行了以下操作(感谢 Igy / Alex 的指导)。请注意,如果用户已安装,Facebook 将返回“installed”=true 的好友 ID 数组(如图所示 此处)。
首先扩展 User 类,添加一个
installed
字段:接下来,使用 DefaultFacebookClient:
Using restFB, I did the following (thanks Igy / Alex for the guidance). Note that Facebook returns an array of friend IDs with "installed"=true if the user is installed (as can be seen here).
First extend the User class, adding an
installed
field:Next, using the DefaultFacebookClient:
解决方法是自己进行过滤。据推测,您在自己的数据库中拥有注册您的应用程序的用户的所有 uid。因此,首先获取所有用户好友的 uid,然后从数据库中选择具有匹配 uid 的用户。
新的 Facebook Graph API 程序似乎执行得很差,而且没有经过深思熟虑。看来他们在成熟之前就急于将其发布到Facebook f8,并且很多功能都尚未成熟。缺少以前可用的。
The workaround is to do the filtering yourself. Presumably, you have all the uid's of the users who have signed up for your application sitting in your own database. So first get all the users' friends' uids, and select the users from your database who have matching uids.
The new Facebook Graph API program seems very poorly executed and not quite thought through. It seems they rushed to publish it for Facebook f8 before it was mature, and lots of functionality is missing that was available before.
您仍然可以在新的 Graph API 中调用旧的 REST API。这是完全正确的。
另一种方法是使用 FQL 来获取应用程序用户的好友。
我不确定是否有办法仅使用 Graph API 来做到这一点。
You can still call the old REST API's in the new Graph API. That is prefectly valid.
An alternative way is to use FQL to get the application user's friends.
I'm not sure if there's a way to do this using just Graph API.