CreateComment - Amazon WorkDocs

CreateComment

Adds a new comment to the specified document version.

Request Syntax

POST /api/v1/documents/DocumentId/versions/VersionId/comment HTTP/1.1 Authentication: AuthenticationToken Content-type: application/json { "NotifyCollaborators": boolean, "ParentId": "string", "Text": "string", "ThreadId": "string", "Visibility": "string" }

URI Request Parameters

The request uses the following URI parameters.

AuthenticationToken

Amazon WorkDocs authentication token. Not required when using AWS administrator credentials to access the API.

Length Constraints: Minimum length of 1. Maximum length of 8199.

DocumentId

The ID of the document.

Length Constraints: Minimum length of 1. Maximum length of 128.

Pattern: [\w+-.@]+

Required: Yes

VersionId

The ID of the document version.

Length Constraints: Minimum length of 1. Maximum length of 128.

Pattern: [\w+-.@]+

Required: Yes

Request Body

The request accepts the following data in JSON format.

NotifyCollaborators

Set this parameter to TRUE to send an email out to the document collaborators after the comment is created.

Type: Boolean

Required: No

ParentId

The ID of the parent comment.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 128.

Pattern: [\w+-.@]+

Required: No

Text

The text of the comment.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 2048.

Required: Yes

ThreadId

The ID of the root comment in the thread.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 128.

Pattern: [\w+-.@]+

Required: No

Visibility

The visibility of the comment. Options are either PRIVATE, where the comment is visible only to the comment author and document owner and co-owners, or PUBLIC, where the comment is visible to document owners, co-owners, and contributors.

Type: String

Valid Values: PUBLIC | PRIVATE

Required: No

Response Syntax

HTTP/1.1 201 Content-type: application/json { "Comment": { "CommentId": "string", "Contributor": { "CreatedTimestamp": number, "EmailAddress": "string", "GivenName": "string", "Id": "string", "Locale": "string", "ModifiedTimestamp": number, "OrganizationId": "string", "RecycleBinFolderId": "string", "RootFolderId": "string", "Status": "string", "Storage": { "StorageRule": { "StorageAllocatedInBytes": number, "StorageType": "string" }, "StorageUtilizedInBytes": number }, "Surname": "string", "TimeZoneId": "string", "Type": "string", "Username": "string" }, "CreatedTimestamp": number, "ParentId": "string", "RecipientId": "string", "Status": "string", "Text": "string", "ThreadId": "string", "Visibility": "string" } }

Response Elements

If the action is successful, the service sends back an HTTP 201 response.

The following data is returned in JSON format by the service.

Comment

The comment that has been created.

Type: Comment object

Errors

For information about the errors that are common to all actions, see Common Errors.

DocumentLockedForCommentsException

This exception is thrown when the document is locked for comments and user tries to create or delete a comment on that document.

HTTP Status Code: 409

EntityNotExistsException

The resource does not exist.

HTTP Status Code: 404

FailedDependencyException

The AWS Directory Service cannot reach an on-premises instance. Or a dependency under the control of the organization is failing, such as a connected Active Directory.

HTTP Status Code: 424

InvalidCommentOperationException

The requested operation is not allowed on the specified comment object.

HTTP Status Code: 409

ProhibitedStateException

The specified document version is not in the INITIALIZED state.

HTTP Status Code: 409

ServiceUnavailableException

One or more of the dependencies is unavailable.

HTTP Status Code: 503

UnauthorizedOperationException

The operation is not permitted.

HTTP Status Code: 403

UnauthorizedResourceAccessException

The caller does not have access to perform the action on the resource.

HTTP Status Code: 404

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: