Facebook 图 API /me/Feed V2.4 与 V2.3

Facebook Graph API /me/Feed V2.4 vs V2.3

我正在尝试使用 Graph API 访问 facebook 用户的所有提要。

但是,从 V2.3 到 V2.4,我得到的响应截然不同。

在 2.4 版中使用指令 /me/Feed 无法接收到帖子的完整信息,只是 returns 一些字段,而在以前的版本中可以访问所有信息。可以看出以下答案的差异。

V2.4

{
"data": [
    {
      "message": "A brincar com o Xico Zé.. ;)",
      "created_time": "2015-07-11T18:23:59+0000",
      "id": "10153293007088673_120153297333223673"
    },
    {
      "message": "Ana Simões e Pedro Simões este é que é bom para a Liliana Assunção..",
      "story": "Diogo Lopes shared Classic Hits 4FM's video.",
      "created_time": "2015-07-11T14:20:59+0000",
      "id": "10153293007088673_1360153296966998673"
    }
],
  "paging": {
    . . .
  }
}

V2.3

{
  "data": [
    {
      "id": "10153129496378673_120153297333223673",
      "from": {
        "name": "Diogo Lopes",
        "id": "10153129496378673"
      },
      "message": "A brincar com o Xico Zé.. ;)",
      "picture": "",
      "link": "",
      "name": "Diogo Lopes on Instagram: “A brincar com o Xico Zé.. ;)”",
      "caption": "Diogo Lopes on Instagram: “A brincar com o Xico Zé.. ;)”",
      "description": "A brincar com o Xico Zé.. ;)",
      "icon": "https://www.facebook.com/images/icons/post.gif",
      "actions": [
. . .
      ],
      "privacy": {
        "value": "ALL_FRIENDS",
        "description": "Your friends",
        "friends": "",
        "allow": "",
        "deny": ""
      },
      "type": "photo",
      "status_type": "added_photos",
      "object_id": "120153297333233673",
      "application": {
        ". . ."
      },
      "created_time": "2015-07-11T18:23:59+0000",
      "updated_time": "2015-07-12T20:50:19+0000",
      "is_hidden": false,
      "subscribed": true,
      "is_expired": false,
      "likes": {
        . . .
        ],
        "paging": {
          . . .
        }
      },
      "comments": {
        "data": [
         . . .
        ],
        "paging": {
          . . .
        }
      }
    },
    {
      "id": "10153129496378673_1360153296966998673",
      "from": {
        "name": "Diogo Lopes",
        "id": "10153129496378673"
      },
      "to": {
        . . .      },
      "message": "………....",
      "message_tags": {
. . .
      },
      "story": "Diogo Lopes shared Classic Hits 4FM's video.",
      "story_tags": {
        "0": [
          {
            "id": "10153129496378673",
            "name": "Diogo Lopes",
            "type": "user",
            "offset": 0,
            "length": 11
          }
        ],
        "19": [
          {
            "id": "125659037470226",
            "name": "Classic Hits 4FM",
            "type": "page",
            "offset": 19,
            "length": 16
          }
        ],
        "38": [
          {
            "id": "874724002563722",
            "name": "",
            "offset": 38,
            "length": 5
          }
        ]
      },
      "picture": "https://fbcdn-vthumb-a.akamaihd.net/hvthumb-ak-xta1/v/t15.0-10/s130x130/11331624_874724179230371_2123630990_n.jpg?oh=701da51ed6690c70ba8d3e7ba5cbb58c&oe=56273FFC&__gda__=1448812275_e37392fe85f01402fa0565b0086df710",
      "link": "https://www.facebook.com/ClassicHits4FM/videos/874724002563722/",
      "source": "https://video.xx.fbcdn.net/hvideo-xtp1/v/t42.1790-2/11656282_889978921061393_14476072_n.mp4?efg=eyJybHIiOjQ4NCwicmxhIjo1MTJ9&rl=484&vabr=269&oh=a4e7e8ec985cf5374082e5c9639d5b06&oe=55A5ED2C",
      "name": "Classic Hits 4FM",
      "description": "A Giant Nope!!!

Would you go on this Swiss Ride?",
      "actions": [
. . .
      ],
      "privacy": {
        "value": "EVERYONE",
        "description": "Public",
        "friends": "",
        "allow": "",
        "deny": ""
      },
      "type": "video",
      "status_type": "mobile_status_update",
      "created_time": "2015-07-11T14:20:59+0000",
      "updated_time": "2015-07-11T21:28:06+0000",
      "is_hidden": false,
      "subscribed": true,
      "is_expired": false,
      "likes": {
        . . .
        ],
        "paging": { . . . }
      },
      "comments": {
}
…
}

有人可以帮助我知道如何在 V2.4 中获得与 V2.3 类似的响应吗??

观察。我的 facebook 应用程序有 user_posts 权限。

自从 Graph API 升级后,即版本 2.4。您必须专门传递一个 fields 参数,其中包含您要检索的数据的相关关键字。

请参考thisFacebook开发者文档

Changes from v2.3 to v2.4

Declarative Fields

To try to improve performance on mobile networks, Nodes and Edges in v2.4 requires that you explicitly request the field(s) you need for your GET requests. For example, GET /v2.4/me/feed no longer includes likes and comments by default, but GET /v2.4/me/feed?fields=comments,likes will return the data. For more details see the docs on how to request specific fields.

v2.4 示例:

<page_id>/feed?fields=id,message,picture,likes,shares,comments