使用Graph API获取我的朋友的朋友 [英] Get the Friends of my friend using the Graph API

查看:117
本文介绍了使用Graph API获取我的朋友的朋友的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用新的Graph API做一个非常基本的事情。



我已经知道如何让我的朋友:
https://graph.facebook.com/me/friends?access_token=4333ed34d ..



但是,如果我有一个朋友的身份是123456,那么我想让他的朋友:
https://graph.facebook.com/123456/friends?access_token = 4333ed34d ...



但我收到一个例外:


远程服务器返回错误:(500)内部服务器错误。


为什么我不能这样做?从API获得一个非常简单的任务。

解决方案

如果我尝试获取一个随机用户的朋友,我得到HTTP 500但是它包含这个响应:

  {
error:{
type:Exception ,
message:(#604)无法查找< UID> ;.的所有朋友。只能查找登录用户(< MY_UID>)或登录用户的朋友适当的许可
}
}

这是非常不言自明的。



如果我尝试让我的朋友的朋友允许查看他的其他朋友,它可以正常工作。如果我的朋友选择不允许查看他的其他朋友,我会收到相同的错误。


I am trying to do a very basic thing with the new Graph API.

I already know how to get my friends: "https://graph.facebook.com/me/friends?access_token=4333ed34d..."

But if I have a friend who's ID is 123456, then I want to get his friends : "https://graph.facebook.com/123456/friends?access_token=4333ed34d..."

But I get an exception:

"The remote server returned an error: (500) Internal Server Error."

Why can't I do that? It's a very trivial task to ask from the API.

解决方案

If I try to get friends of a random user I get HTTP 500 but it contains this response:

{
   "error": {
      "type": "Exception",
      "message": "(#604) Can't lookup all friends of <UID>. Can only lookup for the logged in user (<MY_UID>), or friends of the logged in user with the appropriate permission"
   }
}

which is pretty self-explanatory.

If I try to get friends of my friend who allows viewing his other friends it works fine. If my friend chose to not allow viewing his other friends I get the same error.

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

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