2

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

但是,我从 V2.3 到 V2.4 得到了完全不同的响应。

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

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权限。

4

1 回答 1

7

由于 Graph API 的升级,即 2.4 版。您必须专门传递一个fields带有相关关键字的参数,即您想要检索的数据。

请参考Facebook 开发者的这份文档

从 v2.3 到 v2.4 的更改

声明性字段

为了尝试提高移动网络的性能,v2.4 中的节点和边缘要求您明确请求 GET 请求所需的字段。例如,GET /v2.4/me/feed 默认不再包含点赞和评论,但 GET /v2.4/me/feed?fields=comments,likes 会返回数据。有关更多详细信息,请参阅有关如何请求特定字段的文档。

v2.4 的一个例子:

<page_id>/feed?fields=id,message,picture,likes,shares,comments
于 2015-07-13T18:24:54.050 回答