Skip to main content

revisions

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

Overview

Namerevisions
TypeResource
Idgoogleworkspace.drivev3.revisions

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringOutput only. The ID of the revision.
exportLinksobjectOutput only. Links for exporting Docs Editors files to specific formats.
keepForeverbooleanWhether to keep this revision forever, even if it is no longer the head revision. If not set, the revision will be automatically purged 30 days after newer content is uploaded. This can be set on a maximum of 200 revisions for a file. This field is only applicable to files with binary content in Drive.
kindstringOutput only. Identifies what kind of resource this is. Value: the fixed string "drive#revision". (default: drive#revision)
lastModifyingUserobjectInformation about a Drive user. (id: User)
md5ChecksumstringOutput only. The MD5 checksum of the revision's content. This is only applicable to files with binary content in Drive.
mimeTypestringOutput only. The MIME type of the revision.
modifiedTimestring (date-time)The last time the revision was modified (RFC 3339 date-time).
originalFilenamestringOutput only. The original filename used to create this revision. This is only applicable to files with binary content in Drive.
publishAutobooleanWhether subsequent revisions will be automatically republished. This is only applicable to Docs Editors files.
publishedbooleanWhether this revision is published. This is only applicable to Docs Editors files.
publishedLinkstringOutput only. A link to the published revision. This is only populated for Docs Editors files.
publishedOutsideDomainbooleanWhether this revision is published outside the domain. This is only applicable to Docs Editors files.
sizestring (int64)Output only. The size of the revision's content in bytes. This is only applicable to files with binary content in Drive.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectfileId, revisionIdacknowledgeAbuseGets a revision's metadata or content by ID. For more information, see Manage file revisions.
listselectfileIdpageSize, pageTokenLists a file's revisions. For more information, see Manage file revisions.
updateupdatefileId, revisionIdUpdates a revision with patch semantics. For more information, see Manage file revisions.
deletedeletefileId, revisionIdPermanently deletes a file version. You can only delete revisions for files with binary content in Google Drive, like images or videos. Revisions for other files, like Google Docs or Sheets, and the last remaining file version can't be deleted. For more information, see Manage file revisions.

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
fileIdstring
revisionIdstring
acknowledgeAbuseboolean
pageSizeinteger (int32)
pageTokenstring

SELECT examples

Gets a revision's metadata or content by ID. For more information, see Manage file revisions.

SELECT
id,
exportLinks,
keepForever,
kind,
lastModifyingUser,
md5Checksum,
mimeType,
modifiedTime,
originalFilename,
publishAuto,
published,
publishedLink,
publishedOutsideDomain,
size
FROM googleworkspace.drivev3.revisions
WHERE fileId = '{{ fileId }}' -- required
AND revisionId = '{{ revisionId }}' -- required
AND acknowledgeAbuse = '{{ acknowledgeAbuse }}'
;

UPDATE examples

Updates a revision with patch semantics. For more information, see Manage file revisions.

UPDATE googleworkspace.drivev3.revisions
SET
data__id = '{{ id }}',
data__mimeType = '{{ mimeType }}',
data__kind = '{{ kind }}',
data__published = {{ published }},
data__exportLinks = '{{ exportLinks }}',
data__keepForever = {{ keepForever }},
data__md5Checksum = '{{ md5Checksum }}',
data__modifiedTime = '{{ modifiedTime }}',
data__publishAuto = {{ publishAuto }},
data__publishedOutsideDomain = {{ publishedOutsideDomain }},
data__publishedLink = '{{ publishedLink }}',
data__size = '{{ size }}',
data__originalFilename = '{{ originalFilename }}',
data__lastModifyingUser = '{{ lastModifyingUser }}'
WHERE
fileId = '{{ fileId }}' --required
AND revisionId = '{{ revisionId }}' --required
RETURNING
id,
exportLinks,
keepForever,
kind,
lastModifyingUser,
md5Checksum,
mimeType,
modifiedTime,
originalFilename,
publishAuto,
published,
publishedLink,
publishedOutsideDomain,
size;

DELETE examples

Permanently deletes a file version. You can only delete revisions for files with binary content in Google Drive, like images or videos. Revisions for other files, like Google Docs or Sheets, and the last remaining file version can't be deleted. For more information, see Manage file revisions.

DELETE FROM googleworkspace.drivev3.revisions
WHERE fileId = '{{ fileId }}' --required
AND revisionId = '{{ revisionId }}' --required
;