首页 文章

使用Graph API获取Facebook反应

提问于
浏览
31

Facebook刚刚发布了新的反应按钮,但我无法找到从Graph API v2.5获取此信息的方法,因为/ likes边缘仅返回交互的总数 .

有没有人想出办法让每个帖子得到这个详细的反应?

7 回答

  • 3

    编辑:截至2016年4月12日,Facebook发布了帖子的反应终点,作为他们的GraphAPI v2.6版本的一部分

    GET /v2.6//reactions

    更多信息可以在这里找到:https://developers.facebook.com/docs/graph-api/reference/post/reactions

    结束编辑

    我不确定Facebook是否已发布此信息,但反应信息目前在Graph API v2.5中提供 . 我粘贴了下面的回复 . 我通过点击洞察 endpoints 实现了这个结果 . 对于下面的响应中列出的每个对象,请查看“id”属性,它具有更精细的查询 endpoints .

    GET /v2.5/{object-id}/insights
    

    响应:

    {
      "name": "post_reactions_like_total",
      "period": "lifetime",
      "values": [
        {
          "value": 0
        }
      ],
      "title": "Lifetime Like Reactions",
      "description": "Lifetime: The total number of like reactions to your post.",
      "id": "{node_id}/insights/post_reactions_like_total/lifetime"
    },
    {
      "name": "post_reactions_love_total",
      "period": "lifetime",
      "values": [
        {
          "value": 0
        }
      ],
      "title": "Lifetime Love Reactions",
      "description": "Lifetime: The total number of love reactions to your post.",
      "id": "{node_id}/insights/post_reactions_love_total/lifetime"
    },
    {
      "name": "post_reactions_wow_total",
      "period": "lifetime",
      "values": [
        {
          "value": 0
        }
      ],
      "title": "Lifetime Wow Reactions",
      "description": "Lifetime: The total number of wow reactions to your post.",
      "id": "{node_id}/insights/post_reactions_wow_total/lifetime"
    },
    {
      "name": "post_reactions_haha_total",
      "period": "lifetime",
      "values": [
        {
          "value": 0
        }
      ],
      "title": "Lifetime Haha Reactions",
      "description": "Lifetime: The total number of haha reactions to your post.",
      "id": "{node_id}/insights/post_reactions_haha_total/lifetime"
    },
    {
      "name": "post_reactions_sorry_total",
      "period": "lifetime",
      "values": [
        {
          "value": 0
        }
      ],
      "title": "Lifetime Sorry Reactions",
      "description": "Lifetime: The total number of sorry reactions to your post.",
      "id": "{node_id}/insights/post_reactions_sorry_total/lifetime"
    },
    {
      "name": "post_reactions_anger_total",
      "period": "lifetime",
      "values": [
        {
          "value": 0
        }
      ],
      "title": "Lifetime Anger Reactions",
      "description": "Lifetime: The total number of anger reactions to your post.",
      "id": "{node_id}/insights/post_reactions_anger_total/lifetime"
    },
    {
      "name": "post_reactions_by_type_total",
      "period": "lifetime",
      "values": [
        {
          "value": {
            "like": 0,
            "love": 0,
            "wow": 0,
            "haha": 0,
            "sorry": 0,
            "anger": 0
          }
        }
      ],
      "title": "Lifetime Reactions by type",
      "description": "Lifetime: The total number of reactions to your post by type.",
      "id": "{node_id}/insights/post_reactions_by_type_total/lifetime"
    }
    
  • 2

    Facebook刚刚发布了Graph API 2.6,反应 endpoints 也是如此

    GET /v2.6/{object-id}/reactions
    

    返回了类似的东西

    {
      "data": [
        {
          "id": "ACCOUNT-ID",
          "name": "ACCOUNT-NAME",
          "type": "HAHA"
        },
        {
          "id": "ACCOUNT-ID",
          "name": "ACCOUNT-NAME",
          "type": "LIKE"
        }
      ],
      "paging": {
        "cursors": {
          "before": "TkRZAMU9EWTROakF6TmpBM01qYzJPak2TnpnNE5qUTRNRE0zT1RFek16RXkZD",
          "after": "TVRBd01EQTNOekEwTWpnME1EUTJPakUwTazJNVFl4TXc9PQZDZD"
        }
      }
    }
    

    这里有更多的信息:https://developers.facebook.com/docs/graph-api/reference/post/reactions/

  • 11

    下一版本的GraphAPI(2.6)将在3月/ 4月的时间框架内发布 - 所以我希望能在那里看到它 .

  • 6

    新反应图片:http://i.stack.imgur.com/d6kcp.jpg

    没有关于这个主题的任何信息,所以我想添加一些东西 .

    下一版本的GraphAPI(2.6)将在3月/ 4月的时间框架内发布 - 所以我希望能在那里看到它 . (谢谢贾斯汀鲍勒)

    现在在图api 2.5新的Facebook反应不计 . 如果你看帖子喜欢你看不到它们,所以我们必须等待新的api版本 .

  • 3

    这些反应已经通过insights API v2.5提供 . 您可以通过 post_reactions_by_type_total edge在页面级别通过 page_actions_post_reactions_total edge获取它们 .

  • 2

    尝试

    GET /v2.5/{post_id}/insights/post_reactions_by_type_total
    

    哪个回报

    {
     "data": [
      {
         "name": "post_reactions_by_type_total",
         "period": "lifetime",
         "values": [
            {
               "value": {
                  "like": 9,
                  "love": 0,
                  "wow": 1,
                  "haha": 0,
                  "sorry": 0,
                  "anger": 0
               }
            }
         ],
         "title": "Daily total post reactions by type.",
         "description": "Daily total post reactions by type.",
         "id": "{post_id}/insights/post_reactions_by_type_total/lifetime"
       }
     ],
    }
    

    我在Facebook Graph API 2.3中使用了相同的运气,但并不是每个请求都有

  • 1

    现在没有计算新的反应 . 当前的API只是表示类似按钮的计数,哇,悲伤,ETC点击不计入喜欢桶

相关问题