Graph API Version

Object Reactions

Represents reactions on a Comment or Post.

Reading

Get reactions on a Comment or Post.

View Insights for more information on Page and Post reactions.

Requirements

Marketing Apps

  • ads_management
  • pages_read_engagement
  • pages_show_list

Page Management Apps

  • pages_show_list

Sample Request

The following example is a GET request made by a User who has reacted to their own object.

curl -i -X GET \
 "https://graph.facebook.com/your-post-id/reactions?access_token=your-user-access-token"
GraphRequest request = GraphRequest.newGraphPathRequest(
  accessToken,
  "/your-post-id/reactions",
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});

request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/your-post-id/reactions"
           parameters:nil
           HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];
FB.api(
  '/your-post-id/reactions',
  'GET',
  {},
  function(response) {
      // Insert your code here
  }
);
try {
  // Returns a `FacebookFacebookResponse` object
  $response = $fb->get(
    '/your-post-id/reactions',
    '{access-token}'
  );
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();

The JSON Response

{
  "data": [
    {
      "id": "your-user-id",
      "name": "Your Name",
      "type": "HAHA"
    }
  ],
  "paging": {
    "cursors": {
      "before": "QVFIUk5YbXFFbG8yVWVOa2w0ZAGhmSUNKMkZAZAOXZARbzJOMHM0TUFtZAnhJbWdPdkF4OURUTHJrQjFqQ2RQZAVN1UGxSVU5FWURENnE4OUFPeXFreU1jV09pdFJR",
      "after": "QVFIUkpsWVRkcVl6SlhsdWlrcGdudl8xVEhwVEJ5ZA3FXdG90bTRxam13NmJDUGpQVnB5ZA29lMG9FVmFaeU1BLW1hc2oZD"
    }
  }
}

If the User or Page has not reacted to the object being queried, data will be empty.

The following example is a GET request for the total reactions to an object.

curl -i -X GET \
 "https://graph.facebook.com/your-post-id
   ?fields=reactions.summary(total_count)
   &access_token=your-access-token"
GraphRequest request = GraphRequest.newGraphPathRequest(
  accessToken,
  "/your-post-id",
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});

Bundle parameters = new Bundle();
parameters.putString("fields", "reactions.summary(total_count)");
request.setParameters(parameters);
request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/your-post-id"
           parameters:@{ @"fields": @"reactions.summary(total_count)",}
           HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];
FB.api(
  '/your-post-id',
  'GET',
  {"fields":"reactions.summary(total_count)"},
  function(response) {
      // Insert your code here
  }
);
try {
  // Returns a `FacebookFacebookResponse` object
  $response = $fb->get(
    '/your-post-id',
    '{access-token}'
  );
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();

The JSON Response if the User or Page has reacted to their own object.

{
  "reactions": {
    "data": [
      {
        "id": "your-user-id",
        "name": "Your Name",
        "type": "HAHA"
      }
    ],
    "paging": {
      "cursors": {
        "before": "QVFIUk5YbXFFbG8yVWVOa2w0ZAGhmSUNKMkZAZAOXZARbzJOMHM0TUFtZAnhJbWdPdkF4OURUTHJrQjFqQ2RQZAVN1UGxSVU5FWURENnE4OUFPeXFreU1jV09pdFJR",
        "after": "QVFIUkpsWVRkcVl6SlhsdWlrcGdudl8xVEhwVEJ5ZA3FXdG90bTRxam13NmJDUGpQVnB5ZA29lMG9FVmFaeU1BLW1hc2oZD"
      }
    },
    "summary": {
      "total_count": 28
    }
  },
  "id": "your-post-id"
}

The JSON Response if the User or Page has not reacted to their own object.

{
  "reactions": {
    "data": [
    ],
    "paging": {
      "cursors": {
        "before": "QVFIUk5YbXFFbG8yVWVOa2w0ZAGhmSUNKMkZAZAOXZARbzJOMHM0TUFtZAnhJbWdPdkF4OURUTHJrQjFqQ2RQZAVN1UGxSVU5FWURENnE4OUFPeXFreU1jV09pdFJR",
        "after": "QVFIUkpsWVRkcVl6SlhsdWlrcGdudl8xVEhwVEJ5ZA3FXdG90bTRxam13NmJDUGpQVnB5ZA29lMG9FVmFaeU1BLW1hc2oZD"
      }
    },
    "summary": {
      "total_count": 28
    }
  },
  "id": "your-post-id"
}

A User or Page can only query their own reactions. Other Users' or Pages' reactions are unavailable due to privacy concerns.

The "like" reaction counts include both "like" and "care" reactions.

Parameters

NameDescription

type

enum {NONE, LIKE, LOVE, WOW, HAHA, SORRY, ANGRY}

The type of reaction a Page or User marked an object.

Fields

Reading from this edge will return a JSON formatted result

{
    "data": [],
    "paging": {},
    "summary": {}
}

data

The Profile of the Page or User running the query, if the object being queried was reacted to by the Page or User, and a list of reaction types:

FieldDescription

type

enum {NONE, LIKE, LOVE, WOW, HAHA, SORRY, ANGRY}

The type of reaction a Page or User marked an object.

For reactions on Posts, this edge does not return a Profile except for the current user, if read with a user access token.

View the count of an individual reaction

curl -i -X GET \
 "https://graph.facebook.com/your-object-id
   ?fields=reactions.type(LOVE).limit(0).summary(total_count)
   &access_token=your-access-token"
GraphRequest request = GraphRequest.newGraphPathRequest(
  accessToken,
  "/your-object-id",
  new GraphRequest.Callback() {
    @Override
    public void onCompleted(GraphResponse response) {
      // Insert your code here
    }
});

Bundle parameters = new Bundle();
parameters.putString("fields", "reactions.type(LOVE).limit(0).summary(total_count)");
request.setParameters(parameters);
request.executeAsync();
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
    initWithGraphPath:@"/your-object-id"
           parameters:@{ @"fields": @"reactions.type(LOVE).limit(0).summary(total_count)",}
           HTTPMethod:@"GET"];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
    // Insert your code here
}];
FB.api(
  '/your-object-id',
  'GET',
  {"fields":"reactions.type(LOVE).limit(0).summary(total_count)"},
  function(response) {
      // Insert your code here
  }
);
try {
  // Returns a `FacebookFacebookResponse` object
  $response = $fb->get(
    '/your-object-id',
    '{access-token}'
  );
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}
$graphNode = $response->getGraphNode();

Example JSON Returned

{
  "reactions": {
    "data": [
    ],
    "summary": {
      "total_count": 3498
    }
  },
  "id": "your-object-id"
}

paging

For more details about pagination, see the Graph API's paging documentation. Adding limit(0) to reactions will remove paging from the output.

summary

Aggregated information about the edge, such as counts. Specify the fields to fetch in the summary param (like summary=total_count).

FieldDescription

total_count

unsigned int32

Total number of reactions

viewer_reaction

enum {NONE, LIKE, LOVE, WOW, HAHA, SORRY, ANGRY}

The type of reaction a Page or User marked an object.

Validation Rules

ErrorDescription

100

Invalid parameter

Creating

This operation is not supported.

Updating

This operation is not supported.

Deleting

This operation is not supported.