Facebook Graph API - 喜欢返回一个空集
当我尝试在 Facebook Graph API 上获取所有“喜欢”(以前的粉丝页面)时,有时它会返回一个空集:
{
"data": [
]
}
我尝试使用 https://graph.facebook.com/me/likes?access_token=MY_ACCESS_TOKEN 并使用 graph.facebook.com/vinch/likes? access_token=MY_ACCESS_TOKEN 但结果完全相同(空)。
知道它会是什么吗?我需要它来知道用户是否喜欢(是)特定页面。
When I try to get all my "likes" (formerly fan pages) on Facebook Graph API, sometimes it returns me an empty set:
{
"data": [
]
}
I tried with https://graph.facebook.com/me/likes?access_token=MY_ACCESS_TOKEN and with graph.facebook.com/vinch/likes?access_token=MY_ACCESS_TOKEN but the result is exactly the same (empty).
Any idea of what it can be? I need it to know if a user likes (is fan of) a specific page.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
我的测试用户在获得点赞权限之前就批准了我的应用程序,因此它从未获得点赞授权。通过从测试用户的个人资料中删除该应用程序并再次授权,我能够获得他们的喜欢。
My test user had approved my app before the likes permission had been granted so it was never picking up the likes authorisation. By removing the app from the test user's profile and authorising again I was able to get their likes.
由于权限问题,您无法获得
帖子
的点赞
。https://developers.facebook.com/文档/graph-api/reference/v4.0/object/likes#readperms
You cannot get
likes
of apost
because of permission concern problem.https://developers.facebook.com/docs/graph-api/reference/v4.0/object/likes#readperms
将 user_likes 权限添加到您的应用程序
add user_likes permission to your application
我在 2010 年 12 月 12 日的 变更日志 中读到:
因此,您可以使用 Graph API 检查已知的 user_id 是否是已知 page_id 的粉丝,并使用完全相同的语法。您需要提供有效的 access_token。通过 fields 参数,您可以选择 API 应返回的内容。例如,如果用户是粉丝,则附加“&fields=id,name,picture”以获取 id、名称和图片。
如果用户不是粉丝,您将得到空结果
I read in the Changelog of 2010-12-12:
So, you can check with Graph API if a known user_id is fan of a known page_id with exactly this syntax. You need to supply a valid access_token. With the fields parameter you can choose, what the API should return. E.g. append "&fields=id,name,picture" to get the id, name and picture in case the user is a fan.
You'll get an empty result if the user is not a fan
如果您使用的是 Graph API Explorer。您可以通过获取顶部的“获取访问令牌”按钮并指定 user_likes 并单击“确定”来设置权限。再次尝试您的代码。
希望这会有所帮助
If you are using Graph API Explorer. you can set permissions by taking get Access Token Button on the Top and specify user_likes and click ok.. Try your code again..
Hope this helps
)
昨天 Facebook 固定点赞 (http://developers.facebook.com/live_status#msg_612 只能得到用户点赞,不能得到对象点赞。例如,您无法通过page_id获取所有用户。
Yesterday facebook fixed likes (http://developers.facebook.com/live_status#msg_612)
You can get only user likes not object likes. For example, you can not get all users by page_id.
如果您需要知道的只是用户是否是某物的粉丝(而不是喜欢列表或粉丝列表),这应该可以解决问题: http://developers.facebook.com/docs/reference/rest/pages.isFan。
If all you need to know is whether or not a user is a fan of something (and not a list of likes or a list of fans) this should do the trick: http://developers.facebook.com/docs/reference/rest/pages.isFan.
您无法通过 API 获得粉丝页面的点赞。
请关注此错误以获取更多信息:
http://bugs.developers.facebook.net/show_bug.cgi?id=12880
You can't get the likes of a fan page through the API.
Follow this bug for more info:
http://bugs.developers.facebook.net/show_bug.cgi?id=12880