LoginSignup
1

More than 5 years have passed since last update.

Facebook Graph APIで投稿リストのリアクション数を取得する方法

Posted at

投稿IDリストでリアクション数を取得できるエンドポイントです。

https://graph.facebook.com/v2.8/?ids=
  195152223850783_1439793239386669,
  195152223850783_1438730836159576
&fields=
  reactions.type(LIKE).limit(0).summary(total_count).as(reactions_like),
  reactions.type(LOVE).limit(0).summary(total_count).as(reactions_love),
  reactions.type(WOW).limit(0).summary(total_count).as(reactions_wow),
  reactions.type(HAHA).limit(0).summary(total_count).as(reactions_haha),
  reactions.type(SAD).limit(0).summary(total_count).as(reactions_sad),
  reactions.type(ANGRY).limit(0).summary(total_count).as(reactions_angry)
&access_token=アクセストークン

結果

{
   "195152223850783_1439793239386669": {
      "reactions_like": {
         "data": [],
         "summary": {
            "total_count": 11385
         }
      },
      "reactions_love": {
         "data": [],
         "summary": {
            "total_count": 528
         }
      },
      "reactions_wow": {
         "data": [],
         "summary": {
            "total_count": 81
         }
      },
      "reactions_haha": {
         "data": [],
         "summary": {
            "total_count": 5
         }
      },
      "reactions_sad": {
         "data": [],
         "summary": {
            "total_count": 1
         }
      },
      "reactions_angry": {
         "data": [],
         "summary": {
            "total_count": 0
         }
      },
      "id": "195152223850783_1439793239386669"
   },
   "195152223850783_1438730836159576": {
      "reactions_like": {
         "data": [],
         "summary": {
            "total_count": 5512
         }
      },
      "reactions_love": {
         "data": [],
         "summary": {
            "total_count": 176
         }
      },
      "reactions_wow": {
         "data": [],
         "summary": {
            "total_count": 119
         }
      },
      "reactions_haha": {
         "data": [],
         "summary": {
            "total_count": 1
         }
      },
      "reactions_sad": {
         "data": [],
         "summary": {
            "total_count": 0
         }
      },
      "reactions_angry": {
         "data": [],
         "summary": {
            "total_count": 1
         }
      },
      "id": "195152223850783_1438730836159576"
   }
}

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1