Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook Graph API - likes returns me an empty set

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.

like image 542
Vinch Avatar asked Jun 02 '10 09:06

Vinch


People also ask

Is Facebook Graph API deprecated?

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.

Is Facebook Graph API restful?

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.

What 3 terms does Facebook use to describe what the graph API is composed of?

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.


Video Answer


2 Answers

add user_likes permission to your application

like image 70
Omar Avatar answered Sep 19 '22 15:09

Omar


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": [     ] } 
like image 21
Mike Bretz Avatar answered Sep 17 '22 15:09

Mike Bretz