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

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

问题描述

我正在尝试使用新的 Graph API 做一些非常基本的事情.

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

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

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

但是如果我有一个朋友,他的 ID 是 123456,那么我想得到 他的 朋友:"https://graph.facebook.com/123456/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..."

但我得到一个例外:

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

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

为什么我不能这样做?从 API 中询问是一项非常微不足道的任务.

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

推荐答案

如果我尝试获取随机用户的朋友,我会收到 HTTP 500,但它包含以下响应:

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"
   }
}

这是不言自明的.

如果我尝试让我朋友的朋友允许查看他的其他朋友,那么效果很好.如果我的朋友选择不允许查看他的其他朋友,我也会收到同样的错误.

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天全站免登陆