When getting a post comments list using POST_ID/comments, each comment contains a Boolean field named "user_likes" that tells me if the user likes the comment or not (this is how i decide which button to display like/unlike).
When getting the list of posts the post itself does not contain this field. I can still post to POST_ID/likes and DELETE to this address to change the like state, but there is no indication of the current state of the like.
Am i missing something? Is there an other way to determine the like state of the post?
If you query the posts using /me/feed (for example) you can influence what fields are returned by adding the "fields" query param. In this case you can use "likes". This contains an array with all likes. You have to check if the user is a member of this array. The returned data by the FQL-variant mentioned by TommyBs is a little prettier (as often with FQL) though.
Example: /me/feed?fields=id,likes will return all posts ids and who liked them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With