Dig*_*ris 38 facebook facebook-like facebook-graph-api
我目前正在使用Facebook图形API搜索来搜索帖子
http://graph.facebook.com/search?q=iwatch&type=post&access_token=xxxxx
Run Code Online (Sandbox Code Playgroud)
它以JSON格式字段返回并用于包含类似:给定帖子的count.
在7月10日之后阅读了开发路线图(https://developers.facebook.com/roadmap/)以了解更改后,我被指示使用该summary=true参数,但我不知道如何使用搜索功能?
来自FB博客的路线图.
从'comments'中删除'count'图API连接我们正在删除Graph API中'comments'连接上未记录的'count'字段.
{id}/comments?summary=true如果您想要包含计数的摘要字段(现在称为'total_count'),请明确请求
我尝试了各种组合并搜索了示例但没有骰子.任何人都可以给我一些建议,如何让新的摘要= true在搜索网址中搜索帖子?
dvk*_*dvk 140
在文档中找不到这个,但不需要多次调用API.您可以在查询Feed或多个帖子时使用摘要.在fields参数中指定它.
https://graph.facebook.com/PAGE_ID/feed?fields=comments.limit(1).summary(true),likes.limit(1).summary(true)
Run Code Online (Sandbox Code Playgroud)
这将返回这样的响应.
{
"data": [
{
....
"summary": {
"total_count": 56
}
...
},
{
....
"summary": {
"total_count": 88
}
...
}
]
}
Run Code Online (Sandbox Code Playgroud)
这比为每个对象单独请求获得评论或喜欢的数量要快得多.
Nic*_*mak 20
您还可以在一个请求中获取所有帖子>评论>喜欢:
https://graph.facebook.com/<obj_id>/feed?fields=message,comments.limit(10).summary(true){message,from,likes.limit(0).summary(true)}
Run Code Online (Sandbox Code Playgroud)
大括号是嵌套请求.
这给出了以下结果:
{
"data": [
{
"message": "Contents of the Post"
"id": "123456789123456789",
"comments": {
"data": [
{
"message": "Contents of the Comment",
"from": {
"name": "John Doe",
"id": "123456789"
},
"likes": {
"data": [],
"summary": {
"total_count": 14,
"can_like": true,
"has_liked": false
}
},
...
Run Code Online (Sandbox Code Playgroud)
摘要是关于post对象的喜欢连接
只是打电话
https://graph.facebook.com/POST_ID/likes?summary=true&access_token=XXXXXXXXXXXX
将有一个带有'total_count'字段的'summary'元素
小智 7
要获得页面相似的数量,您可以使用fan_count字段.
search?q=xxx&fields=fan_count&type=page
Run Code Online (Sandbox Code Playgroud)
小智 5
我像这样构建我的API查询,它允许我获取一次性查询:
https://graph.facebook.com/PAGE_ID/feed?fields=comments.limit(25).summary(true),likes.limit(25).summary(true)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
67792 次 |
| 最近记录: |