black_blood
black_blood

Reputation: 155

Facebook Graph API - Getting the number of likes of pages using Search API (Different Access Tokens behaving differently)

I am trying to get the number of likes for Facebook Pages searched by a keyword.

https://graph.facebook.com/search?q=paul&type=page&fields=likes&access_token=xxx

I have tried with two different tokens (with no data permissions),
1) generated from Facebook Graph API Explorer, and
2) generated from Facebook Login Button (after developing a facebook app).

The above API request gave total number of likes when the first token is used.
first token response

And it gave likes object with paging(without total likes) when the second token is used.
second token response

I need to get total number of likes for a page when the second token is used. Can someone help me, or shed some light?

Upvotes: 0

Views: 497

Answers (1)

andyrandy
andyrandy

Reputation: 74014

It is fan_count, not likes (since v2.6 of the Graph API):

/search?q=paul&type=page&fields=fan_count

You are most likely using different API versions.

Check out the API reference for the existing fields: https://developers.facebook.com/docs/graph-api/reference/page/

Upvotes: 0

Related Questions