When I try to get all my "likes" (formerly fan pages) on Facebook Graph API, sometimes it returns me an empty set:
{ "data": [ ] }
I tried with https://graph.facebook.com/me/likes?access_token=MY_ACCESS_TOKEN and with graph.facebook.com/vinch/likes?access_token=MY_ACCESS_TOKEN but the result is exactly the same (empty).
Any idea of what it can be? I need it to know if a user likes (is fan of) a specific page.
API Version Deprecations: As part of Facebook's Graph API and Marketing API, please note the upcoming deprecations: August 3, 2021: Graph API v3. 3 will be deprecated and removed from the platform. August 25, 2021 Marketing API v9.
Because the Facebook Graph API is a restful JSON API, you can run queries directly in any standard browser; you'd simply be making HTTP calls.
The Graph API is named after the idea of a "social graph" — a representation of the information on Facebook. It's composed of nodes, edges, and fields.
add user_likes permission to your application
I read in the Changelog of 2010-12-12:
GET [page-id]/members/[user-id] will return the individual user if he or she is a fan of the page (Graph API equivalent of pages.isFan) (rE322057)
So, you can check with Graph API if a known user_id is fan of a known page_id with exactly this syntax. You need to supply a valid access_token. With the fields parameter you can choose, what the API should return. E.g. append "&fields=id,name,picture" to get the id, name and picture in case the user is a fan.
{ "data": [ { "id": "712084216", "name": "Mike Bretz", "picture": "http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs842.snc4/70441_712084216_5491098_q.jpg" } ] }
You'll get an empty result if the user is not a fan
{ "data": [ ] }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With