API获取Facebook反应

API获取Facebook反应

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

问题描述

Facebook刚刚发布了新的反应按钮,但是我无法找出一种从Graph API v2.5获取这些信息的方式,因为/ likes edge只返回总共的交互次数。

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已经发布了一个反馈终端作为他们的v2.6版本的GraphAPI

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

可以在这里找到更多的信息:

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

END EDIT

我不知道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

RESPONSE:

   {
  "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反应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 19:36