I am wondering whether it is possible to obtain the reactions for all comments on a particular post? That is, for each comment on the post, can I also obtain the reactions in the current version of the API.
Question posted in Facebook API
The official documentation for the Facebook APIs can be found here.
The official documentation for the Facebook APIs can be found here.
2
Answers
It’s possible. Facebook Doc hasn’t updated yet. (I think.)
But you can use “reactions” keyword with comment’s objects.
Try this code with your sample Comment’s ID and Token.
Replace {comment_id} and {Your_Token} by your Comment’s ID and Token.
For all comments of post, you can use the same with Post’ ID. See syntax on Facebook Doc
So if you need a raw count, you can simply add
reactions
to the fields.For example:
Then you can iterate over all comment and they have the reaction count included. Because you need the counts of the different types you can use the field aliasing. This looks like:
I used a String concatenation to provide a better overview. You have to adapt this to your language.