Box Developer Documentation

Join BoxWorks 2024 to discover what's possible with content and AI!

Register now!

Update comment

put
https://api.box.com/2.0
/comments/:comment_id

Update the message of a comment.

Request

bearer [ACCESS_TOKEN]
application/json

Path Parameters

stringin pathrequired
12345

The ID of the comment.

Query Parameters

string arrayin queryoptional
id,type,name

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

stringin bodyoptional
"Review completed!"

The text of the comment to update

Response

application/jsonComment (Full)

Returns the updated comment object.

application/jsonClient error

An unexpected client error.

put
Update comment
You can now try out some of our APIs live, right here in the documentation.
Log in

Request Example

cURL
curl -i -X PUT "https://api.box.com/2.0/comments/12345" \
     -H "authorization: Bearer <ACCESS_TOKEN>" \
     -H "content-type: application/json" \
     -d '{
       "message": "My New Message"
     }'
TypeScript Gen
await client.comments.updateCommentById(newReplyComment.id!, {
  requestBody: { message: newMessage } satisfies UpdateCommentByIdRequestBody,
} satisfies UpdateCommentByIdOptionalsInput);
Python Gen
client.comments.update_comment_by_id(new_reply_comment.id, message=new_message)
.NET Gen
await client.Comments.UpdateCommentByIdAsync(commentId: NullableUtils.Unwrap(newReplyComment.Id), requestBody: new UpdateCommentByIdRequestBody() { Message = newMessage });
Swift Gen (Beta)
try await client.comments.updateCommentById(commentId: newReplyComment.id!, requestBody: UpdateCommentByIdRequestBody(message: newMessage))
Java
BoxComment comment = new BoxComment(api, "id");
comment.changeMessage("An edited message.");
Python
edited_comment = client.comment(comment_id='98765').edit('If possible, please finish this by Friday!')
.NET
var requestParams = new BoxCommentRequest()
{
    Message = "New message"
};
BoxComment updatedComment = await client.CommentsManager.UpdateAsync(id: "11111", requestParams);
Node
client.comments.update('11111', {message: 'New message'})
    .then(comment => {
        /* comment -> {
            type: 'comment',
            id: '11111',
            is_reply_comment: false,
            message: 'New message',
            created_by: 
            { type: 'user',
                id: '22222',
                name: 'Example User',
                login: 'user@example.com' },
            created_at: '2012-12-12T11:25:01-08:00',
            item: { id: '33333', type: 'file' },
            modified_at: '2012-12-12T11:25:01-08:00' }
        */
    });
iOS
client.comments.update(
    commentId: "55555",
    message: "Updated message"
) { (result: Result<Comment, BoxSDKError>) in
    guard case let .success(comment) = result else {
        print("Error updating comment")
        return
    }

    print("Comment message updated")
}

Response Example

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