Take the 2-minute tour ×

I am trying to upgrade my iPhone app to use the new facebook graph api. One thing I cannot find is how to find out if the current user connected from my app to facebook is a fan of my facebook page - (i.e. in the new paradigm - whether the user likes my page)

In the Rest Api there was a function isFan, but not in the Graph.

I can get all items the user likes and search whether one of them is my page, but certainly there must be an easier way instead of going trough thousands of records each time I must check whether he is a fan, right?

If someone already figured it out how to do that from their new docs, I'll really appreciate if you share it with me.

share|improve this question
add comment

5 Answers

According to the Facebook Dev docs the old pages.isFan method has an equivalent in the Graph API now

Please note: We are in the process of deprecating the REST API, and have added equivalent support to the Graph API for this method. You can now issue a HTTP GET request to /USER_ID/likes/PAGE_ID to check if a user is a page of a fan.

As per this, a call to /{USER ID}/likes/{PAGE ID} will return the necessary information provided you have the correct (user_likes) Permission or the user's likes are public

share|improve this answer
add comment

The quickest and simples solution if you parse the $_POST variable when your page is called by Facebook. The signed_request has the information (as well), the user like your page or not, even s/he hasn't give access to your app (yet).

share|improve this answer
Sandor - as you can see from the question, I'm talking about iPhone application, are you sure your answer is relevant? –  Ican Zilb Nov 11 '11 at 20:09
add comment

What you're looking for is the connection table. Try this:

SELECT target_id, target_type
FROM connection

That is an FQL statement that can be run from the FB.api JavaScript method, or through any of the backend SDKs.

share|improve this answer
You'll need the read_stream extended permission in order to access that table, the current preferred solution is a GET request to /{user id}/likes/{page id} –  Igy Nov 9 '11 at 21:48
add comment

With PhoneGap's plugin I can do this:

pageID = '6815841748';
FB.api('/me', function (a) {
   user_id = a.id;
   FB.api('/' + user_id + '/likes/'+pageID, function (a) {

It will return 1 if they like the given page ID, 0 otherwise.

I discovered (but have not tested) a possibly cleaner method:

window.checkDoesLike = function() {
  FB.api({ method: 'pages.isFan', page_id: '6815841748' }, function(resp) {
    if (resp) {
      alert('You like.');
    } else {
     alert("You don't like.");
share|improve this answer
add comment

Right now the '//likes' graph resource is the only one available. It isn't too bad though.

share|improve this answer
Hi Nick, as I mentioned in my question - it's really strange to me that I should go trough hundreds or thousands of objects to find whether the user likes a given page id. The "likes" could be great if could say what you are looking for like "me/likes?access_token=...&id=100000000 and gives back yes/no ... –  Ican Zilb May 14 '10 at 9:14
I agree, the least they could do is allow you to filter the response server-side. –  Nick Gerakines May 14 '10 at 14:17
This solution sometimes doesn't work. When Facebook have server problem it returns empty list. Old page.isFan works fine in those cases. –  Tomasz Wysocki Sep 25 '10 at 11:31
add comment

Your Answer


