使用 Facebook Graph API 为页面“点赞" [英] 'Like' a page using Facebook Graph API

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

问题描述

使用图形 API,我希望能够让授权用户喜欢"某个页面.

Using the Graph API I'd like to be able to have an authorized user "like" a page.

我尝试发布以下内容

https://graph.facebook.com/${PAGE_ID}/likes?access_token=${ACCESS_TOKEN}

我在 JSON 响应正文中收到 HTTP 错误 500,并伴有无效的 post_id 参数".看起来 /likes 资源适合点赞墙贴而不是页面.我如何让它与页面一起工作?

And I get an HTTP error 500 accompanied by "Invalid post_id parameter" in the JSON response body. Looks like the /likes resource is suited to liking a wall post and not a page. How do I get this to work with a page?

推荐答案

Facebook 已宣布通过使用官方 内置喜欢动作.您需要具有 publish_actions 权限.这个图形网址是:https://graph.facebook.com/[用户FB ID]/og.likes?object=OG_OBJECT_URL&access_token=USER_ACCESS_TOKEN

Facebook has announced support for liking URL's outside of Facebook by using the official built-in Like action. You need to have publish_actions permissions. The graph url for this is: https://graph.facebook.com/[User FB ID]/og.likes?object=OG_OBJECT_URL&access_token=USER_ACCESS_TOKEN

但是,您目前不能使用它来喜欢 Facebook 上的页面,因为 文档说明:

However, you cannot use this to like a page on Facebook currently, as the documentation states:

对于未与 Facebook 集成的 Facebook 主页或网站身份验证,开发者应该继续使用 Like 按钮社交插件.

For Facebook Pages or websites that do not integrate with Facebook Authentication, developers should continue to use the Like button social plugin.

这篇关于使用 Facebook Graph API 为页面“点赞"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆