我有自己的 Facebook 页面。我想要的是通过发送 API 调用以 JSON 形式访问该页面中的帖子。我不需要像在 oEmbed 中那样将内容作为嵌入式网页返回。解决方法是什么?
- 在 Facebook 开发人员仪表板中,我创建了一个应用程序,这意味着我有客户端 token 和应用程序 ID,以防我需要 access_token 才能通过。
- 我知道我需要访问的 Facebook 页面的页面 ID
是否必须集成 Facebook 登录才能检索此类公共(public)页面内容?
当我运行以下命令时(此处删除了 page_id、app_id 和 client_access 的真实值)
curl -i -X GET "https://graph.facebook.com/page_id?access_token=app_id|client_access"
我遇到了以下错误
{
"error":{
"message":"(#100) Object does not exist, cannot be loaded due to missing permission or reviewable feature, or does not support this operation. This endpoint requires the 'pages_read_engagement' permission or the 'Page Public Content Access' feature or the 'Page Public Metadata Access' feature.. Refer to https:\/\/developers.facebook.com\/docs\/apps\/review\/login-permissions#manage-pages, https:\/\/developers.facebook.com\/docs\/apps\/review\/feature#reference-PAGES_ACCESS and https:\/\/developers.facebook.com\/docs\/apps\/review\/feature#page-public-metadata-accessfor details. ",
"type":"OAuthException",
"code":100,
"fbtrace_id":"Aal5TRTWtw_phIz7-rHzj1L"
}
}
最佳答案
https://developers.facebook.com/docs/graph-api/reference/v9.0/page/feed
本文档解释了如何访问帖子。
您需要导航到此 URL ( https://developers.facebook.com/tools/explorer/ ) 并添加页面访问所需的权限。然后选择右侧显示“用户或页面”的页面 token
您需要页面 token 才能访问任何与页面相关的内容
关于facebook - 如何使用 Graph API 访问公共(public) Facebook 页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65336134/