Reputation: 119
I want to be able to get the total amount of reactions and then split by each type of reaction. This is what I am using so far for getting the total amount of reactions and the count of likes.
me?fields=posts{reactions.summary(true),likes.summary(true)}
However, I would like for the other kind of reactions to be included as well (love, sad, hahah etc.) When I try to query the love field I get the following debug message:
The love field does not exist on the PagePost object.
I've gone through all the node options but I can't find them. Any help will be greatly appreciated since I am quite stuck.
Upvotes: 0
Views: 119
Reputation: 96316
Specific types of reactions can be queried using the type
parameter, see https://developers.facebook.com/docs/graph-api/reference/v6.0/object/reactions#parameters
If you want to query data for multiple reactions in one request, then you will have to use the Field Aliasing syntax, otherwise you will get an error saying that your field list contained the reactions field twice. https://developers.facebook.com/docs/graph-api/aliasing-fields
So this could look something like this,
me?fields=posts{reactions.type(LOVE).summary(1).as(reacts_love),
reactions.type(LIKE).summary(1).as(reacts_like)}
(Exemplary for the two reaction types LOVE and LIKE - add the rest, by following the same format.)
The resulting data will then contain sub-structures under the keys reacts_love
and reacts_like
.
This might still give you some data about individual reactions - if you don’t need those, but only the summaries, you can also add .limit(0)
into the above “chains” of parameters - then the data
portion of these responses will always be empty.
Upvotes: 1