0

Is there a way to find out (or generate a count) of how many posts has a user 'liked' on my facebook profile?

For example, if I provide a userID, can I query that how many of the posts (on a particular facebook profile page) has this user liked?

ssdesign
  • 2,743
  • 6
  • 37
  • 53

1 Answers1

0

You should be able to use FQL for that.

The two FQL tables that are of interest here are:

  • like - "returns the IDs of users who like a given object (video, note, link, photo, or album)"
  • stream - "used to return a list of a stream posts"

You can then use them both like this:

SELECT 
    object_id 
FROM 
    like 
WHERE 
    user_id = USER_ID 
    AND 
    post_id IN (SELECT 
                    post_id 
                FROM 
                    stream 
                WHERE 
                    source_id = PAGE_ID)

You'll need to have two permissions for the logged in user when you try this: read_stream and read_insights.

You can try it in the Graph Api Explorer (just replace the USER_ID and PAGE_ID with real ids)

Nitzan Tomer
  • 155,636
  • 47
  • 315
  • 299
  • Thanks, will try it and let you know how it goes. – ssdesign Apr 18 '12 at 07:01
  • Sorry about this basic question, how do one find post_ID and page_ID? – ssdesign Apr 18 '12 at 07:10
  • You don't need the post_id, just the USER_ID and PAGE_ID (what I wrote in caps). The page id is the id of the page profile that you want to check, it's like a user id but for a page... For example, if you check this graph url of the [South Park page](http://graph.facebook.com/southpark) you'll see the id is "6708787004". You can do the same with your page, replace the "southpark" with the "username" of your page. – Nitzan Tomer Apr 18 '12 at 07:13