Skip to main content

comments

Creates, updates, deletes, gets or lists a comments resource.

Overview

Namecomments
TypeResource
Idgoogleworkspace.drivev2.comments

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
anchorstringA region of the document represented as a JSON string. For details on defining anchor properties, refer to Manage comments and replies.
authorobjectInformation about a Drive user. (id: User)
commentIdstringThe ID of the comment.
contentstringThe plain text content used to create this comment. This is not HTML safe and should only be used as a starting point to make edits to a comment's content.
contextobjectContext of a file which is being commented on.
createdDatestring (date-time)The date when this comment was first created.
deletedbooleanWhether this comment has been deleted. If a comment has been deleted the content will be cleared and this will only represent a comment that once existed.
fileIdstringThe file which this comment is addressing.
fileTitlestringThe title of the file which this comment is addressing.
genoaAuthorobjectThe user who wrote this comment as a GenoaUser. (id: GenoaUser)
htmlContentstringHTML formatted content for this comment.
kindstringThis is always drive#comment. (default: drive#comment)
modifiedDatestring (date-time)The date when this comment or any of its replies were last modified.
repliesarrayReplies to this post.
resolvedbooleanOutput only. Whether the comment has been resolved by one of its replies.
selfLinkstringA link back to this comment.
statusstringThe status of this comment. Status can be changed by posting a reply to a comment with the desired status. Possible values are: * open - The comment is still open. * resolved - The comment has been resolved by one of its replies.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectfileId, commentIdincludeDeletedGets a comment by ID.
listselectfileIdincludeDeleted, maxResults, pageToken, updatedMinLists a file's comments.
insertinsertfileIdCreates a new comment on the given file.
patchupdatefileId, commentIdUpdates an existing comment.
updatereplacefileId, commentIdUpdates an existing comment.
deletedeletefileId, commentIdDeletes a comment.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
commentIdstring
fileIdstring
includeDeletedboolean
maxResultsinteger (int32)
pageTokenstring
updatedMinstring

SELECT examples

Gets a comment by ID.

SELECT
anchor,
author,
commentId,
content,
context,
createdDate,
deleted,
fileId,
fileTitle,
genoaAuthor,
htmlContent,
kind,
modifiedDate,
replies,
resolved,
selfLink,
status
FROM googleworkspace.drivev2.comments
WHERE fileId = '{{ fileId }}' -- required
AND commentId = '{{ commentId }}' -- required
AND includeDeleted = '{{ includeDeleted }}'
;

INSERT examples

Creates a new comment on the given file.

INSERT INTO googleworkspace.drivev2.comments (
data__commentId,
data__kind,
data__createdDate,
data__modifiedDate,
data__fileId,
data__fileTitle,
data__status,
data__anchor,
data__replies,
data__author,
data__deleted,
data__selfLink,
data__htmlContent,
data__content,
data__context,
data__resolved,
data__genoaAuthor,
fileId
)
SELECT
'{{ commentId }}',
'{{ kind }}',
'{{ createdDate }}',
'{{ modifiedDate }}',
'{{ fileId }}',
'{{ fileTitle }}',
'{{ status }}',
'{{ anchor }}',
'{{ replies }}',
'{{ author }}',
{{ deleted }},
'{{ selfLink }}',
'{{ htmlContent }}',
'{{ content }}',
'{{ context }}',
{{ resolved }},
'{{ genoaAuthor }}',
'{{ fileId }}'
RETURNING
anchor,
author,
commentId,
content,
context,
createdDate,
deleted,
fileId,
fileTitle,
genoaAuthor,
htmlContent,
kind,
modifiedDate,
replies,
resolved,
selfLink,
status
;

UPDATE examples

Updates an existing comment.

UPDATE googleworkspace.drivev2.comments
SET
data__commentId = '{{ commentId }}',
data__kind = '{{ kind }}',
data__createdDate = '{{ createdDate }}',
data__modifiedDate = '{{ modifiedDate }}',
data__fileId = '{{ fileId }}',
data__fileTitle = '{{ fileTitle }}',
data__status = '{{ status }}',
data__anchor = '{{ anchor }}',
data__replies = '{{ replies }}',
data__author = '{{ author }}',
data__deleted = {{ deleted }},
data__selfLink = '{{ selfLink }}',
data__htmlContent = '{{ htmlContent }}',
data__content = '{{ content }}',
data__context = '{{ context }}',
data__resolved = {{ resolved }},
data__genoaAuthor = '{{ genoaAuthor }}'
WHERE
fileId = '{{ fileId }}' --required
AND commentId = '{{ commentId }}' --required
RETURNING
anchor,
author,
commentId,
content,
context,
createdDate,
deleted,
fileId,
fileTitle,
genoaAuthor,
htmlContent,
kind,
modifiedDate,
replies,
resolved,
selfLink,
status;

REPLACE examples

Updates an existing comment.

REPLACE googleworkspace.drivev2.comments
SET
data__commentId = '{{ commentId }}',
data__kind = '{{ kind }}',
data__createdDate = '{{ createdDate }}',
data__modifiedDate = '{{ modifiedDate }}',
data__fileId = '{{ fileId }}',
data__fileTitle = '{{ fileTitle }}',
data__status = '{{ status }}',
data__anchor = '{{ anchor }}',
data__replies = '{{ replies }}',
data__author = '{{ author }}',
data__deleted = {{ deleted }},
data__selfLink = '{{ selfLink }}',
data__htmlContent = '{{ htmlContent }}',
data__content = '{{ content }}',
data__context = '{{ context }}',
data__resolved = {{ resolved }},
data__genoaAuthor = '{{ genoaAuthor }}'
WHERE
fileId = '{{ fileId }}' --required
AND commentId = '{{ commentId }}' --required
RETURNING
anchor,
author,
commentId,
content,
context,
createdDate,
deleted,
fileId,
fileTitle,
genoaAuthor,
htmlContent,
kind,
modifiedDate,
replies,
resolved,
selfLink,
status;

DELETE examples

Deletes a comment.

DELETE FROM googleworkspace.drivev2.comments
WHERE fileId = '{{ fileId }}' --required
AND commentId = '{{ commentId }}' --required
;