【问题标题】:FB Graph API - Tried accessing nonexisting field (reactions) on node type (Photo)FB Graph API - 尝试访问节点类型上不存在的字段(反应)(照片)
【发布时间】:2020-12-19 08:04:44
【问题描述】:

我正在使用 FB Graph API 来获取喜欢我的帖子或对我的帖子做出反应的用户的姓名。通过使用

get/version/{post-id}/likes

我已经能够获得所有喜欢的人的姓名和 ID。现在我也想得到其他反应,即哈哈或爱的反应,但是当我使用get/version/{post-id}/reactions时,我得到了这个错误

{
  "error": {
    "message": "(#100) Tried accessing nonexisting field (reactions) on node type (Photo)",
    "type": "OAuthException",
    "code": 100,
    "fbtrace_id": "Abwl9IBIxglskXT3yivpWUm"
  }
} 

是否有可能得到所有反应? 用户将授权该应用程序,因此这不是问题。

【问题讨论】:

    标签: facebook facebook-graph-api fb-graph


    【解决方案1】:

    所以基本上在等待 3 天后,我没有得到任何答复。所以我决定自己发布一个答案。我在这 3 天里发现,不可能得到所有的反应。喜欢和关心是您将获得的唯一数据。

    如果我找到了获得这一切的方法,我会更新答案。

    【讨论】:

      【解决方案2】:

      可以通过请求此端点获取帖子(包括照片)的所有反应:

      {user_id}_{post_id}?fields=
      reactions.type(LOVE).limit(0).summary(total_count).as(love),
      reactions.type(WOW).limit(0).summary(total_count).as(wow),
      reactions.type(HAHA).limit(0).summary(total_count).as(haha),
      reactions.type(LIKE).limit(0).summary(total_count).as(like),
      reactions.type(ANGRY).limit(0).summary(total_count).as(angry),
      reactions.type(SAD).limit(0).summary(total_count).as(sad)
      

      (删除所有换行符,我将它们放入只是为了使 URL 更具可读性)。

      返回

      {
        "love": {
          "data": [
          ],
          "summary": {
            "total_count": 50
          }
        },
        "wow": {
          "data": [
          ],
          "summary": {
            "total_count": 20
          }
        },
        "haha": {
          "data": [
          ],
          "summary": {
            "total_count": 24
          }
        },
        "like": {
          "data": [
          ],
          "summary": {
            "total_count": 60
          }
        },
        "angry": {
          "data": [
          ],
          "summary": {
            "total_count": 1
          }
        },
        "sad": {
          "data": [
          ],
          "summary": {
            "total_count": 1
          }
        },
        "id": "{user_id}_{post_id}"
      }
      

      我从这个post得到了这个答案。

      Facebook API 似乎不支持使用速记 id 获取照片上的反应,但它支持使用速记 id 获取反应,即{user_id}_{post_id}

      【讨论】:

        猜你喜欢
        • 2017-07-13
        • 2017-04-15
        • 2018-07-20
        • 1970-01-01
        • 2015-04-21
        • 1970-01-01
        • 1970-01-01
        • 2020-11-19
        • 2022-01-20
        相关资源
        最近更新 更多