HomeGuidesRecipesAPI ExplorerForumSupport
Partner Portal
Partner Portal

Comments

Learn how to associate comments to all objects in Monite system.

Overview

Every object in the Monite system can have comments associated with them. Monite API Partners can use comments to store additional information about these objects.

Webhooks are sent every time a comment is created, updated, or deleted.

Create a comment

To create a comment, make a POST request to the /comments endpoint providing the type (object_type field) and ID (object_id field) of the object to which the comment is related:

curl -X POST 'https://api.sandbox.monite.com/v1/comments' \
     -H 'X-Monite-Version: 2024-01-31' \
     -H 'X-Monite-Entity-Id: ENTITY_ID' \
     -H 'Authorization: Bearer ACCESS_TOKEN' \
     -H 'Content-Type: application/json' \
     -d '{
        "text": "Comment about a payable.",
        "reply_to_entity_user_id": "9fabf3e8-76bd-400e-85cc-776d42e71c07",
        "object_type": "payable",
        "object_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
      }'

The successful response contains information about the newly created comment and the object to which the comment is related:

{
  "id": "d95eb59f-2781-4c58-b763-4526b3b27b0d",
  "entity_id": "ba2ee5e3-b29d-4594-942c-d962ae9765ed",
  "status": "active",
  "created_by_entity_user_id": "9fabf3e8-76bd-400e-85cc-776d42e71c07",
  "object_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "object_type": "payable",
  "text": "Comment about a payable.",
  "reply_to_entity_user_id": "9fabf3e8-76bd-400e-85cc-776d42e71c07",
  "updated_at": "2023-09-06T07:10:53.879Z",
  "created_at": "2023-09-06T07:10:53.879Z"
}

List all comments

To get a list of all the comments related to a specific object, make a GET request to the /comments endpoint passing the object_type and the object_id of the object to which the comments are related as query parameters:

curl -X POST 'https://api.sandbox.monite.com/v1/comments?object_type=payable&object_id=9d2b4c8f-2087-4738-ba91-7359683c49a4&order=asc&limit=100' \
     -H 'X-Monite-Version: 2024-01-31' \
     -H 'X-Monite-Entity-Id: ENTITY_ID' \
     -H 'Authorization: Bearer ACCESS_TOKEN' \
     -H 'Content-Type: application/json' 

The successful response contains information about all the comments associated with the supplied object:

{
  "data": [
    {
      "id": "d95eb59f-2781-4c58-b763-4526b3b27b0d",
      "entity_id": "ba2ee5e3-b29d-4594-942c-d962ae9765ed",
      "status": "active",
      "created_by_entity_user_id": "9fabf3e8-76bd-400e-85cc-776d42e71c07",
      "object_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "object_type": "payable",
      "text": "Comment about a payable.",
      "reply_to_entity_user_id": "9fabf3e8-76bd-400e-85cc-776d42e71c07",
      "updated_at": "2023-09-06T08:44:46.569Z",
      "created_at": "2023-09-06T08:44:46.569Z"
    }
  ],
  "prev_pagination_token": null,
  "next_pagination_token": null
}

Retrieve a comment

To get information about a specific comment associated with a specific object, make a GET request to the /comments/{comment_id} endpoint.

Edit a comment

To edit a comment of a specific object, make a PATCH request to the /comments/{comment_id}. Only the creator of the comment is allowed to change it:

curl -X PATCH 'https://api.sandbox.monite.com/v1/comments/d95eb59f-2781-4c58-b763-4526b3b27b0d' \
     -H 'X-Monite-Version: 2024-01-31' \
     -H 'X-Monite-Entity-Id: ENTITY_ID' \
     -H 'Authorization: Bearer ACCESS_TOKEN' \
     -H 'Content-Type: application/json' \
     -d '{
       "text": "Updated comment about a payable.",
       "reply_to_entity_user_id": "9fabf3e8-76bd-400e-85cc-776d42e71c07"
     }' 

Delete comment

To delete an existing comment from a specific object, make a DELETE request to the /comments/{comment_id} endpoint.

📘

Deleting a comment requires a role with deletion permission on the comment object.