revisions
Creates, updates, deletes, gets or lists a revisions
resource.
Overview
Name | revisions |
Type | Resource |
Id | googleworkspace.drivev3.revisions |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Name | Datatype | Description |
---|---|---|
id | string | Output only. The ID of the revision. |
exportLinks | object | Output only. Links for exporting Docs Editors files to specific formats. |
keepForever | boolean | Whether 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. |
kind | string | Output only. Identifies what kind of resource this is. Value: the fixed string "drive#revision" . (default: drive#revision) |
lastModifyingUser | object | Information about a Drive user. (id: User) |
md5Checksum | string | Output only. The MD5 checksum of the revision's content. This is only applicable to files with binary content in Drive. |
mimeType | string | Output only. The MIME type of the revision. |
modifiedTime | string (date-time) | The last time the revision was modified (RFC 3339 date-time). |
originalFilename | string | Output only. The original filename used to create this revision. This is only applicable to files with binary content in Drive. |
publishAuto | boolean | Whether subsequent revisions will be automatically republished. This is only applicable to Docs Editors files. |
published | boolean | Whether this revision is published. This is only applicable to Docs Editors files. |
publishedLink | string | Output only. A link to the published revision. This is only populated for Docs Editors files. |
publishedOutsideDomain | boolean | Whether this revision is published outside the domain. This is only applicable to Docs Editors files. |
size | string (int64) | Output only. The size of the revision's content in bytes. This is only applicable to files with binary content in Drive. |
Name | Datatype | Description |
---|---|---|
id | string | Output only. The ID of the revision. |
exportLinks | object | Output only. Links for exporting Docs Editors files to specific formats. |
keepForever | boolean | Whether 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. |
kind | string | Output only. Identifies what kind of resource this is. Value: the fixed string "drive#revision" . (default: drive#revision) |
lastModifyingUser | object | Information about a Drive user. (id: User) |
md5Checksum | string | Output only. The MD5 checksum of the revision's content. This is only applicable to files with binary content in Drive. |
mimeType | string | Output only. The MIME type of the revision. |
modifiedTime | string (date-time) | The last time the revision was modified (RFC 3339 date-time). |
originalFilename | string | Output only. The original filename used to create this revision. This is only applicable to files with binary content in Drive. |
publishAuto | boolean | Whether subsequent revisions will be automatically republished. This is only applicable to Docs Editors files. |
published | boolean | Whether this revision is published. This is only applicable to Docs Editors files. |
publishedLink | string | Output only. A link to the published revision. This is only populated for Docs Editors files. |
publishedOutsideDomain | boolean | Whether this revision is published outside the domain. This is only applicable to Docs Editors files. |
size | string (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:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | fileId , revisionId | acknowledgeAbuse | Gets a revision's metadata or content by ID. For more information, see Manage file revisions. |
list | select | fileId | pageSize , pageToken | Lists a file's revisions. For more information, see Manage file revisions. |
update | update | fileId , revisionId | Updates a revision with patch semantics. For more information, see Manage file revisions. | |
delete | delete | fileId , revisionId | 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. |
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.
Name | Datatype | Description |
---|---|---|
fileId | string | |
revisionId | string | |
acknowledgeAbuse | boolean | |
pageSize | integer (int32) | |
pageToken | string |
SELECT
examples
- get
- list
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 }}'
;
Lists a file's revisions. 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 pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}'
;
UPDATE
examples
- update
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
- delete
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
;