Nick P
Nick P

Reputation: 33

Get Facebook page like count for OpenGraph v2.10

I can't get Facebook to return the page like count, the response provided does not match what the API states. According to the docs, the following URL:

https://graph.facebook.com/v2.10/<page-id>/likes?access_token=<access-token>&summary=true

should return a JSON response with a summary key that provides the like count in the corresponding hash. The problem is the response never contains the summary key, but it does contain the data and pager keys as specified in the docs.

I'm certain my access token is valid and my page ID are correct.

I've also tried to get the page_fans metric from the page insights via the following URL, but it simply returns an empty data object.

https://graph.facebook.com/v2.10/<page-id>/insights/page_fans?access_token=<access-token>

Is there another way to go about retrieving the like count for a page or any particular reason that the requests would succeed, but be missing the relevant data?

Facebook Doc Links:

https://developers.facebook.com/docs/graph-api/reference/v2.10/object/likes

https://developers.facebook.com/docs/graph-api/reference/v2.8/insights

UPDATE

I was able to retrieve the count by using this Graph API call:

https://graph.facebook.com/v2.10/<page-id>?access_token=<access-token>&fields=engagement

As New Hand pointed out, you can get the key directly, without going through the engagement field using the following:

https://graph.facebook.com/v2.10/<page-id>?access_token=<access-token>&fields=fan_count

Upvotes: 1

Views: 531

Answers (1)

New Hand
New Hand

Reputation: 156

Do you mean to get the fan_count?

Please try this:

https://graph.facebook.com/v2.10/<page-id>?access_token=<access-token>&fields=fan_count

Upvotes: 1

Related Questions