Pascal Klein
Pascal Klein

Reputation: 24853

Facebook Api: Get number of likes a post from a user over my app got

I use facebook-connect to let users login with their facebook-account. I also ask them for the right to publish posts on their wall. Now I like to do the following: If my app posted on a users wall in their users name, I like to remember this post and at a later point count the number of likes and comments this post received.

How can I do that?

Upvotes: 2

Views: 3715

Answers (1)

Gublooo
Gublooo

Reputation: 2618

I dont think this should be very difficult. Based on my understanding, let me outline the steps using which you can accomplish this tasks:

1) From your when you make a post to the users wall, you will get back the post_id

2) You will have to save this post_id at your end to keep track of all the posts made through your app

3) Next, anytime you want to find the number of likes to that post - you can run this FQL query which will return all the likes for the given post_id

select post_id, user_id from like where post_id ="5XXXXX107_17XXXXXXXX664"

4) To find the comments for a given post, use this FQL

SELECT post_id,message,comments FROM stream where post_id ="5XXXXX107_17XXXXXXXX664"

You can test these queries here http://developers.facebook.com/docs/reference/rest/fql.query/

Let me know if you need more details

Good Luck

Upvotes: 1

Related Questions