Search code examples
facebookfacebook-graph-apifacebook-fql

How to get the stats of a post using post ID from facebook


I want to get stats (likes, comments, shares) of a Facebook post. How can I do it?


Solution

  • Url: https://graph.facebook.com/<userid>_<postid> - there is a plenty of information about the wall post.

    http://developers.facebook.com/tools/explorer - you can use this tool for testing.

    Sample data:

    {
      "id": "<userid>_<postid>", 
      "from": {
        "name": "User Name", 
        "id": "<userid>"
      }, 
      "message": "playing with graph api", 
      "actions": [
        {
          "name": "Comment", 
          "link": "http://www.facebook.com/<userid>/posts/<postid>"
        }, 
        {
          "name": "Like", 
          "link": "http://www.facebook.com/<userid>/posts/<postid>"
        }
      ], 
      "privacy": {
        "description": "Public", 
        "value": "EVERYONE"
      }, 
      "type": "status", 
      "created_time": "2012-03-14T11:33:14+0000", 
      "updated_time": "2012-03-14T11:33:14+0000", 
      "comments": {
        "count": 0
      }, 
      "is_published": true
    }