NickF
NickF

Reputation: 5737

Facebook get users pictures from fan page

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?

Upvotes: 0

Views: 298

Answers (1)

林果皞
林果皞

Reputation: 7793

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)

Upvotes: 1

Related Questions