使用 Graph API 获取 Facebook 反应 [英] Getting Facebook Reactions with Graph API

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

问题描述

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

Facebook just released the new reaction button, but I can't figure out a way to get this information from the Graph API v2.5 as the /likes edge only returns the total count of interactions.

有没有人想出一种方法来获得每个帖子的详细反应?

Has anyone figured out a way to get this detailed reactions per post?

推荐答案

截至 2016 年 4 月 12 日,Facebook 已经发布了一个帖子的反应端点,作为其 GraphAPI 的 v2.6 版本的一部分

As of April 12th, 2016 Facebook has published a reactions endpoint for posts as part of their v2.6 release of the GraphAPI

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

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

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

More information can be found here: https://developers.facebook.com/docs/graph-api/reference/post/reactions

结束编辑

我不确定 Facebook 是否已发布此消息,但目前在 Graph API v2.5 中提供了反应信息.我粘贴了下面的回复.我通过达到见解端点实现了这一结果.对于下面响应中列出的每个对象,请查看 'id' 属性,它具有更细粒度的查询端点.

I'm not sure if Facebook has published this yet, but the reaction information is currently available in the Graph API v2.5. I pasted the response below. I achieved this result by hitting the insights endpoint. For each object listed in the response below, take a look at the 'id' property, it has more granular query 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"
}

这篇关于使用 Graph API 获取 Facebook 反应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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