Manoj
Manoj

Reputation: 61

How to retrive facebook page likes count in graph API? API returning empty set

When i try to get facebook pages likes count using graph api, I dint get anything likes page likes count.

GET /v2.10/{page_id}/likes RETURNS empty set

So i try

GET https://graph.facebook.com/v2.10/{PAGE_ID}?fields=id,name,likes.summary(true),link&access_token={ACCESS_TOKEN}

RESULT : 
{
   "id": "513727248979119",
   "name": "Trending men's wear",
   "link": "https://www.facebook.com/Trending-mens-wear-513727248979119/"
}

Upvotes: 1

Views: 2381

Answers (1)

Manoj
Manoj

Reputation: 61

To get the number of users who like the Page. use fan_count instead of likes. As per the documentation description of likes and fan_count are same. but fan_count is working fine. So use

GET https://graph.facebook.com/v2.10/{PAGE_ID}?fields=id,name,**fan_count**,link&access_token={ACCESS_TOKEN}

ref: https://developers.facebook.com/docs/graph-api/reference/page/

Upvotes: 4

Related Questions