0

how to get total likes a post from graph api url ?

Here This Link

Return: array of objects containing the id and name fields. Requesting with summary=1 will also return a summary object containing the total_count of likes.

Mehran Mazhar
  • 63
  • 3
  • 13

1 Answers1

7

in the FB API explorer try fetching likes for a post, i used 700182169998352

the "/700182169998352/likes" return:

{
  "data": [
    {
      "id": "663945278",
      "name": "Irene Olsson Wikler"
    },
    {
      "id": "100002437916716",
      "name": "Frida Braxell"
    },
    {
      "id": "1135121633",
      "name": "Rex Leopold Olsson"
    }
  ],
  "paging": {
    "cursors": {
      "after": "MTEzNTEyMTYzMw==",
      "before": "NjYzOTQ1Mjc4"
    }
  }
}

the "/700182169998352/likes?summary=1" return:

{
  "data": [
    {
      "id": "663945278",
      "name": "Irene Olsson Wikler"
    },
    {
      "id": "100002437916716",
      "name": "Frida Braxell"
    },
    {
      "id": "1135121633",
      "name": "Rex Leopold Olsson"
    }
  ],
  "paging": {
    "cursors": {
      "after": "MTEzNTEyMTYzMw==",
      "before": "NjYzOTQ1Mjc4"
    }
  },
  "summary": {
    "total_count": 3
  }
}

so by adding the ?summary=1 you get an extra part in the json result named summary, and containng the total_count, in my case 3

Puggan Se
  • 5,738
  • 2
  • 22
  • 48