Comments

Adds a comment by the user to a specific file, or as a reply to an other comment.

post/comments

Request

  • Base URL
    https://api.box.com/2.0
  • URL
    https://api.box.com/2.0/comments
  • Auth
    OAuth 2
    Authorization code: https://account.box.com/api/oauth2/authorize
    Token URL: https://api.box.com/oauth2/token

Query parameters

fieldsstring[]

A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response.

Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested.

Request body

messagestring required

The text of the comment.

To mention a user, use the tagged_message parameter instead.

tagged_messagestring

The text of the comment, including @[user_id:name] somewhere in the message to mention another user, which will send them an email notification, letting them know they have been mentioned.

The user_id is the target user's ID, where the name can be any custom phrase. In the Box UI this name will link to the user's profile.

If you are not mentioning another user, use message instead.

Example request

{
  "message": "Review completed!",
  "tagged_message": "@[1234:John] Review completed!",
  "item": {
    "id": "11446498",
    "type": "file"
  }
}

Response

Returns the newly created comment object.

Not all available fields are returned by default. Use the fields query parameter to explicitly request any specific fields.

idstring

The unique identifier for this comment.

type'comment'

The value will always be comment.

is_reply_commentboolean

Whether or not this comment is a reply to another comment.

messagestring

The text of the comment, as provided by the user.

created_atstring date-time

The time this comment was created.

modified_atstring date-time

The time this comment was last modified.

tagged_messagestring

The string representing the comment text with @mentions included. @mention format is @[id:username] where id is user's Box ID and username is their display name.

Example response

{
  "id": "11446498",
  "type": "comment",
  "is_reply_comment": true,
  "message": "@Aaron Levie these tigers are cool!",
  "created_by": {
    "id": "11446498",
    "type": "user",
    "name": "Aaron Levie",
    "login": "ceo@example.com"
  },
  "created_at": "2012-12-12T10:53:43-08:00",
  "modified_at": "2012-12-12T10:53:43-08:00",
  "item": {
    "id": "11446498",
    "type": "file"
  },
  "tagged_message": "@[1234567:Aaron Levie] these tigers are cool!"
}

Changes

    • warning

      added the new unprocessable_entity enum value to the response property for the response status