0

I'm working an Android application and I need to get 6 pictures of latest users that join the fan page.
At that stage there is no specific user authentication.
I thought to use FB open graph.
How can I do that?

NickF
  • 5,637
  • 12
  • 44
  • 75

1 Answers1

1

No, it's impossible via facebook API.

As indicated at https://developers.facebook.com/docs/reference/fql/page_fan/, you must give the uid in the WHERE clause. So if you only know the PAGE_ID and you don't know what the uid is, then you can't query the users who liked a page, what you get is total users who liked the page.

Normally, what you can do is get 6 pictures of latest friends who liked the page, for example, youtube page_id '7270241753' :

SELECT pic_square FROM profile WHERE id IN (SELECT uid FROM page_fan WHERE page_id = '7270241753' AND uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) ORDER BY created_time DESC LIMIT 6)

You can test with Grahp API explorer(Make sure you granted access token with permission friends_likes):

It works because you can get the uid from friend table.

You can also include yourself(make sure you granted user_likes permission too):

SELECT pic_square FROM profile WHERE id IN (SELECT uid FROM page_fan WHERE page_id = '7270241753' AND (uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) or uid=me()) ORDER BY created_time DESC LIMIT 6)
林果皞
  • 7,539
  • 3
  • 55
  • 70
  • But as an ower of FB application (Not fan page), can I got a list of all users which maked an authenication to my android app or people how did like on the fan page? – NickF May 02 '13 at 11:08
  • 1
    No, even you are the owner of app, you unable to query user_id who use the apps. Normally you query based on friend id. Similar discussion here http://stackoverflow.com/questions/5521457/how-to-get-all-my-facebook-application-users. May be you can take a look at https://developers.facebook.com/docs/reference/api/app-game-groups/ too(i'm not familiar this) – 林果皞 May 02 '13 at 11:32
  • Another discussion about query user_id who use the apps: http://stackoverflow.com/questions/9081147/get-list-of-facebook-users-who-are-using-specific-application-using-fql – 林果皞 May 02 '13 at 11:38