无法查询具有喜欢计数的多个帖子

Can't query for multiple posts with likes count

我想查询 Graph API 以获得一组帖子(带有它们的 ID)。假设我有一个数组 {firstId, secondId ...}。我尝试过的一种方法是:

v2.2/?ids=firstId,secondId...

只要我不想通过添加任何 "fields" 参数来获得 likes/comments 计数摘要,它就可以正常工作。

?fields=likes.limit(1).summary(true),comments.limit(1).summary(true)

关于如何在一个请求中合并 ID 和字段参数有什么想法吗?

放置 ID 列表后添加您的查询

示例,

?ids=80329313253_10153216064543254,80329313253_10153211628853254&fields=likes.limit(1).summary(true),comments.limit(1).summary(true)

{
  "80329313253_10153216064543254": {
    "id": "80329313253_10153216064543254", 
    "created_time": "2015-02-26T20:41:53+0000", 
    "likes": {
      "data": [
        {
          "id": "1463487230582100", 
          "name": "Anchidtha Lomthampinij"
        }
      ], 
      "paging": {
        "cursors": {
          "after": "MTQ2MzQ4NzIzMDU4MjEwMA==", 
          "before": "MTQ2MzQ4NzIzMDU4MjEwMA=="
        }, 
        "next": "https://graph.facebook.com/v2.2/80329313253_10153216064543254/likes?limit=1&summary=true&after=MTQ2MzQ4NzIzMDU4MjEwMA=="
      }, 
      "summary": {
        "total_count": 318822
      }
    }, 
    "comments": {
      "data": [
        {
          "id": "10153216063838254_10153216079943254", 
          "from": {
            "id": "704159799640259", 
            "name": "Akshatha Bhat"
          }, 
          "message": "If I owned you, you'd never have to dream about treats because I would give you them all the time Boo!", 
          "can_remove": false, 
          "created_time": "2015-02-26T20:47:39+0000", 
          "like_count": 193, 
          "user_likes": false
        }
      ], 
      "paging": {
        "cursors": {
          "after": "Mjg3OQ==", 
          "before": "Mjg3OQ=="
        }, 
        "next": "https://graph.facebook.com/v2.2/80329313253_10153216064543254/comments?limit=1&summary=true&after=Mjg3OQ=="
      }, 
      "summary": {
        "order": "ranked", 
        "total_count": 2879
      }
    }
  }, 
  "80329313253_10153211628853254": {
    "id": "80329313253_10153211628853254", 
    "created_time": "2015-02-24T20:15:34+0000", 
    "likes": {
      "data": [
        {
          "id": "744777938907452", 
          "name": "Faya Gurbanli"
        }
      ], 
      "paging": {
        "cursors": {
          "after": "NzQ0Nzc3OTM4OTA3NDUy", 
          "before": "NzQ0Nzc3OTM4OTA3NDUy"
        }, 
        "next": "https://graph.facebook.com/v2.2/80329313253_10153211628853254/likes?limit=1&summary=true&after=NzQ0Nzc3OTM4OTA3NDUy"
      }, 
      "summary": {
        "total_count": 407425
      }
    }, 
    "comments": {
      "data": [
        {
          "id": "10153211628843254_10153211643418254", 
          "from": {
            "id": "398118870328160", 
            "name": "Nicole Newell"
          }, 
          "message": "This is the most precious pup I've ever seen. Can we clone him?", 
          "can_remove": false, 
          "created_time": "2015-02-24T20:21:32+0000", 
          "like_count": 385, 
          "user_likes": false
        }
      ], 
      "paging": {
        "cursors": {
          "after": "Mzk5Nw==", 
          "before": "Mzk5Nw=="
        }, 
        "next": "https://graph.facebook.com/v2.2/80329313253_10153211628853254/comments?limit=1&summary=true&after=Mzk5Nw=="
      }, 
      "summary": {
        "order": "ranked", 
        "total_count": 3997
      }
    }
  }
}

谢谢 CBroe 指出 'basically what i was asking was how to put more than one query string parameter into an URL which is of course done by separating them with an ampersand'。结合我的参数后,我得到了工作查询:

v2.2/?ids=firstId,secondId&fields=id,picture,likes.limit(1).summary(true)