[英]facebook graph api sharedpost get amount of likes from the page that shared
I use the sharedpost endpoint to retrieve the pages that shared my post like this: 我使用sharedpost端点来检索共享我的帖子的页面,如下所示:
{post_id}/sharedposts?fields=likes.summary(1),id,created_time,from.summary(1)&limit=1500
This will return the data like: 这将返回如下数据:
{
"id": "{sharedpost_id}",
"created_time": "2017-05-13T23:01:51+0000",
"from": {
"name": "Page that shared",
"id": "Id of page that shared"
},
"likes": {
"data": [
],
"summary": {
"total_count": 0,
"can_like": false,
"has_liked": false
}
}
}
Now some posts get a shitload of shares so I want to filter only the shares by pages that have above a certain amount of likes. 现在,有些帖子获得了大量分享,因此我只想按喜欢量超过一定的页面过滤分享。
Now I can make a second call to the api which asks for the amount of likes but I hope it would be possible to do this in the same request. 现在,我可以再次调用api,要求获得喜欢的数量,但我希望可以在同一请求中执行此操作。
So The desired output would be: 因此,所需的输出将是:
{
"id": "{sharedpost_id}",
"created_time": "2017-05-13T23:01:51+0000",
"from": {
"name": "Page that shared",
"id": "Id of page that shared"
"likes: : "Likes of the page that shared"
},
"likes": {
"data": [
],
"summary": {
"total_count": 0,
"can_like": false,
"has_liked": false
}
}
}
So with the likes of the page included in the from. 因此,喜欢的页面包含在from中。
Is this possible? 这可能吗?
Thanks in advance! 提前致谢!
Can be done using Field Expansion : 可以使用Field Expansion完成:
/post-id/sharedposts?fields=from{name,fan_count}
And if you need this not only for single posts, but for all posts in a page's feed, you can also move that “one level up”, like so: 而且,如果您不仅需要单个帖子,还需要页面供稿中的所有帖子,则也可以将其“上一级”移动,如下所示:
/page-id/feed?fields=sharedposts{from{name,fan_count}}
I am not exactly sure if that still works, if you also get shared posts by users returned - in that case it might throw an error, that fan_count
is not an existing field on the user object. 我不确定这是否仍然有效,如果您还获得了返回的用户的共享帖子-在这种情况下,它可能会引发错误,表明fan_count
不是用户对象上的现有字段。
This would only be relevant for posts shared by users that have logged in to your app, and granted it user_posts
permission (because only then would you see those posts show in the sharedposts edge in the first place) - so if that is not applicable in your situation, it will be fine; 这仅与已登录到您的应用并授予user_posts
权限的用户共享的帖子有关(因为只有这样,您才首先看到那些帖子显示在sharedposts边缘)-因此,如果这不适用于您的情况会很好; otherwise I suggest you test this case before relying on it. 否则,我建议您在依靠之前先测试一下这种情况。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.