As Facebook released the new reaction{NONE, LIKE, LOVE, WOW, HAHA, SAD, ANGRY} feature for post, but I can not figure out to get all reaction counts in single graph API request.
Has anyone figured out a way to get this detailed reactions per post in single request?
You can access Page Insights by typing /insights after the name of your page in the URL field. This command will retrieve all of the Insights associated with your Page. Type "/insights" after your company name. Click the Submit button.
From “Graph API Explorer” drop down, select your app. Then, select “Get Token”. From this drop down, select “Get User Access Token”. Select permissions from the menu that appears and then select “Get Access Token.”
The approach introduced by @CBroe appears to be working using Multiple ID Read Requests.
?ids=7175346442_10153799389241443,7175346442_10153799470326443&fields=reactions.type(LOVE).limit(0).summary(total_count).as(reactions_love),reactions.type(WOW).limit(0).summary(total_count).as(reactions_wow),reactions.type(HAHA).limit(0).summary(total_count).as(reactions_haha),...
Screenshot from Facebook Graph API Explorer:
Once a collection of posts is retrieved, one should be able to read reaction counts grouped by type using a single request. Note, the current limit of ids in the Multiple ID Read Request pattern is 50.
Theoretically possible using Field Expansion in combination with Field Aliases, like this:
?fields=reactions.type(LIKE).limit(0).summary(1).as(like),
reactions.type(WOW).limit(0).summary(1).as(wow),
reactions.type(SAD).limit(0).summary(1).as(sad),…
But there still seem to be some bugs in that regard; I frequently got “An unknown error has occurred” while testing this; f.e. replacing the limit value for LIKE with 1 in the above query triggers it …
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