获得 facebook 喜欢每条评论,而无需为每个评论 ID 单独调用。

Getting facebook likes per comment without making separate calls per comment id.

当我得到一个 facebook 页面评论列表时:

nike/posts?fields=comments

对于每条评论,我只得到以下字段:

         "created_time": "",
            "from": {
              "name": "",
              "id": ""
            },
            "message": "",
            "id": "10155265827713445_10155266595898445"

有没有办法同时请求每个评论的 likes/reactions 计数摘要?我唯一的方法就是获取 id,然后对每个评论进行另一个调用,这有点疯狂(而且很慢):

10155265827713445_10155266595898445?fields=reactions.limit(0).summary(true)

然后我取自:

 "reactions": {
    "data": [
    ],
    "summary": {
      "total_count": 0,
      "viewer_reaction": "NONE"
    }

您可以为此使用字段扩展语法,https://developers.facebook.com/docs/graph-api/using-graph-api/#fieldexpansion

nike/posts?fields=comments{reactions.limit(0).summary(true)}

如果您还需要评论对象的其他字段,您需要通过将它们添加到列表中来请求它们,以逗号分隔。