Facebook Graph API 获取所有用户及其状态
我正在使用 Facebook Graph API,我想知道是否可以通过一次调用获取所有用户及其当前状态的列表?
我基本上想要与 https://graph.facebook.com/me/friends 相同的结果,但是每个对象都包含当前状态。
感谢您的帮助!
编辑:
这里有一些澄清。如果 https://graph.facebook.com/me/friends?access_token=... 给我这个:(又名我所有朋友的列表)
{
"data": [
{
"name": "Foo",
"id": "1"
},
{
"name": "Bar",
"id": "2"
},
{
"name": "Foo Bar",
"id": "3"
},
{
"name": "Bar Foo",
"id": "4"
}
]
}
什么 URL 或 FQL 会给我这个:(又称我所有朋友及其状态的列表)
{
"data": [
{
"name": "Foo",
"id": "1"
"status": "This is my current status!"
},
{
"name": "Bar",
"id": "2"
"status": "This is my current status!"
},
{
"name": "Foo Bar",
"id": "3"
"status": "This is my current status!"
},
{
"name": "Bar Foo",
"id": "4"
"status": "This is my current status!"
}
]
}
我只想打一个电话,因为与我不同的是,大多数人有 100 多个朋友,而且我不想仅仅为了获取状态而打 100 多个电话。
I am using the Facebook Graph API and I was wondering if there was anyway to get a list of all the users and their current status in one call?
I basically want the same results as https://graph.facebook.com/me/friends but with the current status included per object.
Thanks for any help!
EDIT:
Here is some clarification. if https://graph.facebook.com/me/friends?access_token=...
gets me this: (AKA a list of all my friends)
{
"data": [
{
"name": "Foo",
"id": "1"
},
{
"name": "Bar",
"id": "2"
},
{
"name": "Foo Bar",
"id": "3"
},
{
"name": "Bar Foo",
"id": "4"
}
]
}
what URL or FQL will get me this: (AKA a list of all my friends and their statuses)
{
"data": [
{
"name": "Foo",
"id": "1"
"status": "This is my current status!"
},
{
"name": "Bar",
"id": "2"
"status": "This is my current status!"
},
{
"name": "Foo Bar",
"id": "3"
"status": "This is my current status!"
},
{
"name": "Bar Foo",
"id": "4"
"status": "This is my current status!"
}
]
}
I only want to make one call, because unlike me, most people have 100+ friends, and I don't want to have to make 100+ calls just to get statuses.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
虽然新的 Batch API 应该可以满足您的要求,但我做不到设法使其正常工作。看来还是有bug。
现在可以使用
fql.multiquery
,这是一个简单的示例:这里我们在第一个查询中获取用户 ID 和名称,并从第二个查询中获取状态消息。
现在,这将在第一个查询或第二个查询中返回更少的结果!因为:
中断
)。While the new Batch API should do what you are asking for, I couldn't manage to make it work properly. It seems that it's still buggy.
Now to achieve this with
fql.multiquery
, here's a quick example:Here we are getting the user id and name in the first query and getting the status messages from the second one.
Now this would return fewer results in the first query or the second! because:
break
).尝试以下 fql:
只需确保限制为特定日期,因为默认情况下这将返回最近 50 次更新/或最近 30 天的活动。
Try the following fql:
Just make sure to limit to a specific date, because this will return the last 50 updates / or last 30 days of activity by default.
您好,您只需要获得user_status 或friend_status的扩展许可即可进行此操作以及任何调用me 对象将获取用户当前状态...
hi you just need to take extended permission of user_status or friend_status for this and any call on me object will grab the user current status...
感谢 @mgilson 的回答,这可以合并为一个 FQL 语句,如下所示:
我发现的神奇之处在于请求
friends_status
权限,这将从公共帖子向朋友和其他人开放,这有助于复制墙的感觉。Thanks to @mgilson for his answer, this can be combined to one FQL statement like this:
The magic I found is requesting the
friends_status
permission which will open up from Public posts to Friends and others which help replicate the feeling of the wall.