skip to Main Content

I am trying to use Facebook’s graph API to access every post in a group’s feed, along with the number of reactions of each type, for every post.

When I try with just one reaction type, it works fine:

[GROUP_ID]/feed/?fields=message,from,created_time,updated_time,reactions.type(LOVE).limit(0).summary(total_count)&limit=1

However, when I add multiple reaction types, I receive an error.

[GROUP_ID]/feed?fields=message,from,created_time,updated_time,reactions.type(LOVE).limit(0).summary(total_count),reactions.type(WOW).limit(0).summary(total_count)&limit=1

gives me:

{
  "error": {
    "message": "Syntax error "Field reactions specified more than once. This is only possible before version 2.1" at character 139: message,from,created_time,updated_time,reactions.type(LOVE).limit(0).summary(total_count),reactions.type(WOW).limit(0).summary(total_count)",
    "type": "OAuthException",
    "code": 2500,
    "fbtrace_id": "GzMCG2dRioK"
  }
}

I followed the syntax in this post, however it seems to only work when trying to access reactions for a single post, not for every post in a feed. Is the only option to use the API to grab the post ID’s for every post in the feed, and then make individual calls on every post?

2

Answers


  1. Try this:

    [GROUP_ID]/feed?fields=message,from,created_time,updated_time  
    ,reactions.type(LOVE).limit(0).summary(total_count).as(reactions_love)
    ,reactions.type(WOW).limit(0).summary(total_count).as(reactions_wow)
    &limit=1
    

    Then you find instead of reactions the fields reactions_love and reactions_wow with your desired data. You can add all types and it is shortened here for a better overview 😉

    Login or Signup to reply.
  2. You can get around the aliasing issue, and still receive what you need, by asking for the following:

        insights.metric(post_reactions_by_type_total).period(lifetime)
    

    (I found it here: Getting Facebook Post all Reactions Count in single Graph API request)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search