Getting user likes of stream items via FQL (posts, comments, pictures, links, etc)

DMCS picture DMCS · Dec 13, 2011 · Viewed 11.6k times · Source

I need assistance in getting user likes of stream items via FQL. I've got some of the likes coming back, but cannot figure out how to get others. For the access_token, every permission is granted.


Let me show you what I've been able to do:

postings I've liked on Page feeds:

fql?q=Select post_id, source_id, message FROM stream where source_id in (SELECT target_id FROM connection WHERE source_id=me() and is_following=1) AND likes.user_likes=1 LIMIT 10 Note: This worked as of mid Dec 2011 when the original question was posted. Now (mid Feb 2012) it is no longer returning anything liked stream content from a page.

postings I've liked of posts that I posted:

fql?q=Select post_id, source_id, message FROM stream where source_id=me() AND likes.user_likes=1 LIMIT 10


Here's what I'm missing

postings I've liked on friends' walls:

fql?q=Select post_id, source_id, message FROM stream where source_id in (SELECT uid1 FROM friend WHERE uid2=me()) AND likes.user_likes=1 & LIMIT 5000

postings I've liked on events' walls:

????

postings I've liked on groups' walls:

????

Answer

BenjyCook picture BenjyCook · Oct 22, 2012

Here's what I've come up with, as of the time of posting (10-22-2012):

For friends/subscribedto/pages items:

SELECT likes, post_id, actor_id, target_id, message
FROM stream
WHERE source_id IN (SELECT target_id FROM connection WHERE source_id=me())
AND likes.user_likes=1 

OR

From 'like' table:

SELECT user_id, object_id, post_id
FROM like
WHERE user_id=me()

But post_id is always null and object_id doesn't exist sometimes when queried via the graph api (i.e. graph.facebook.com/OBJECT_ID )

For links/external objects - There is no direct way to get the facebook post details from this, but it returns a lot of results. Maybe with another query / multiquery looking for these urls in the stream or link tables.

SELECT url
FROM url_like
WHERE user_id=me()