revisions
Creates, updates, deletes, gets or lists a revisions resource.
Overview
| Name | revisions |
| Type | Resource |
| Id | googleworkspace.drivev2.revisions |
Fields
The following fields are returned by SELECT queries:
- get
- list
| Name | Datatype | Description |
|---|---|---|
id | string | Output only. The ID of the revision. |
downloadUrl | string | Output only. Short term download URL for the file. This will only be populated on files with content stored in Drive. |
etag | string | Output only. The ETag of the revision. |
exportLinks | object | Output only. Links for exporting Docs Editors files to specific formats. |
fileSize | string (int64) | Output only. The size of the revision in bytes. This will only be populated on files with content stored in Drive. |
kind | string | Output only. This is always drive#revision. (default: drive#revision) |
lastModifyingUser | object | Output only. The last user to modify this revision. This field is only populated when the last modification was performed by a signed-in user. (id: User) |
lastModifyingUserName | string | Output only. Name of the last user to modify this revision. |
md5Checksum | string | Output only. An MD5 checksum for the content of this revision. This will only be populated on files with content stored in Drive. |
mimeType | string | Output only. The MIME type of the revision. |
modifiedDate | string (date-time) | Last time this revision was modified (formatted RFC 3339 timestamp). |
originalFilename | string | Output only. The original filename when this revision was created. This will only be populated on files with content stored in Drive. |
pinned | boolean | Whether this revision is pinned to prevent automatic purging. If not set, the revision is automatically purged 30 days after newer content is uploaded. This field can only be modified on files with content stored in Drive, excluding Docs Editors files. Revisions can also be pinned when they are created through the drive.files.insert/update/copy by using the pinned query parameter. Pinned revisions are stored indefinitely using additional storage quota, up to a maximum of 200 revisions. |
publishAuto | boolean | Whether subsequent revisions will be automatically republished. This is only populated and can only be modified for Docs Editors files. |
published | boolean | Whether this revision is published. This is only populated and can only be modified for 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 populated and can only be modified for Docs Editors files. |
selfLink | string | Output only. A link back to this revision. |
| Name | Datatype | Description |
|---|---|---|
id | string | Output only. The ID of the revision. |
downloadUrl | string | Output only. Short term download URL for the file. This will only be populated on files with content stored in Drive. |
etag | string | Output only. The ETag of the revision. |
exportLinks | object | Output only. Links for exporting Docs Editors files to specific formats. |
fileSize | string (int64) | Output only. The size of the revision in bytes. This will only be populated on files with content stored in Drive. |
kind | string | Output only. This is always drive#revision. (default: drive#revision) |
lastModifyingUser | object | Output only. The last user to modify this revision. This field is only populated when the last modification was performed by a signed-in user. (id: User) |
lastModifyingUserName | string | Output only. Name of the last user to modify this revision. |
md5Checksum | string | Output only. An MD5 checksum for the content of this revision. This will only be populated on files with content stored in Drive. |
mimeType | string | Output only. The MIME type of the revision. |
modifiedDate | string (date-time) | Last time this revision was modified (formatted RFC 3339 timestamp). |
originalFilename | string | Output only. The original filename when this revision was created. This will only be populated on files with content stored in Drive. |
pinned | boolean | Whether this revision is pinned to prevent automatic purging. If not set, the revision is automatically purged 30 days after newer content is uploaded. This field can only be modified on files with content stored in Drive, excluding Docs Editors files. Revisions can also be pinned when they are created through the drive.files.insert/update/copy by using the pinned query parameter. Pinned revisions are stored indefinitely using additional storage quota, up to a maximum of 200 revisions. |
publishAuto | boolean | Whether subsequent revisions will be automatically republished. This is only populated and can only be modified for Docs Editors files. |
published | boolean | Whether this revision is published. This is only populated and can only be modified for 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 populated and can only be modified for Docs Editors files. |
selfLink | string | Output only. A link back to this revision. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | fileId, revisionId | Gets a specific revision. | |
list | select | fileId | maxResults, pageToken | Lists a file's revisions. Important: The list of revisions returned by this method might be incomplete for files with a large revision history, including frequently edited Google Docs, Sheets, and Slides. Older revisions might be omitted from the response, meaning the first revision returned may not be the oldest existing revision. The revision history visible in the Workspace editor user interface might be more complete than the list returned by the API. |
patch | update | fileId, revisionId | Updates a revision. | |
update | replace | fileId, revisionId | Updates a revision. | |
delete | delete | fileId, revisionId | Permanently deletes a file version. You can only delete revisions for files with binary content, like images or videos. Revisions for other files, like Google Docs or Sheets, and the last remaining file version can't be deleted. |
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 | |
maxResults | integer (int32) | |
pageToken | string |
SELECT examples
- get
- list
Gets a specific revision.
SELECT
id,
downloadUrl,
etag,
exportLinks,
fileSize,
kind,
lastModifyingUser,
lastModifyingUserName,
md5Checksum,
mimeType,
modifiedDate,
originalFilename,
pinned,
publishAuto,
published,
publishedLink,
publishedOutsideDomain,
selfLink
FROM googleworkspace.drivev2.revisions
WHERE fileId = '{{ fileId }}' -- required
AND revisionId = '{{ revisionId }}' -- required
;
Lists a file's revisions. Important: The list of revisions returned by this method might be incomplete for files with a large revision history, including frequently edited Google Docs, Sheets, and Slides. Older revisions might be omitted from the response, meaning the first revision returned may not be the oldest existing revision. The revision history visible in the Workspace editor user interface might be more complete than the list returned by the API.
SELECT
id,
downloadUrl,
etag,
exportLinks,
fileSize,
kind,
lastModifyingUser,
lastModifyingUserName,
md5Checksum,
mimeType,
modifiedDate,
originalFilename,
pinned,
publishAuto,
published,
publishedLink,
publishedOutsideDomain,
selfLink
FROM googleworkspace.drivev2.revisions
WHERE fileId = '{{ fileId }}' -- required
AND maxResults = '{{ maxResults }}'
AND pageToken = '{{ pageToken }}'
;
UPDATE examples
- patch
Updates a revision.
UPDATE googleworkspace.drivev2.revisions
SET
data__lastModifyingUserName = '{{ lastModifyingUserName }}',
data__fileSize = '{{ fileSize }}',
data__modifiedDate = '{{ modifiedDate }}',
data__originalFilename = '{{ originalFilename }}',
data__publishAuto = {{ publishAuto }},
data__published = {{ published }},
data__pinned = {{ pinned }},
data__publishedOutsideDomain = {{ publishedOutsideDomain }},
data__publishedLink = '{{ publishedLink }}',
data__md5Checksum = '{{ md5Checksum }}',
data__downloadUrl = '{{ downloadUrl }}',
data__id = '{{ id }}',
data__exportLinks = '{{ exportLinks }}',
data__kind = '{{ kind }}',
data__lastModifyingUser = '{{ lastModifyingUser }}',
data__mimeType = '{{ mimeType }}',
data__etag = '{{ etag }}',
data__selfLink = '{{ selfLink }}'
WHERE
fileId = '{{ fileId }}' --required
AND revisionId = '{{ revisionId }}' --required
RETURNING
id,
downloadUrl,
etag,
exportLinks,
fileSize,
kind,
lastModifyingUser,
lastModifyingUserName,
md5Checksum,
mimeType,
modifiedDate,
originalFilename,
pinned,
publishAuto,
published,
publishedLink,
publishedOutsideDomain,
selfLink;
REPLACE examples
- update
Updates a revision.
REPLACE googleworkspace.drivev2.revisions
SET
data__lastModifyingUserName = '{{ lastModifyingUserName }}',
data__fileSize = '{{ fileSize }}',
data__modifiedDate = '{{ modifiedDate }}',
data__originalFilename = '{{ originalFilename }}',
data__publishAuto = {{ publishAuto }},
data__published = {{ published }},
data__pinned = {{ pinned }},
data__publishedOutsideDomain = {{ publishedOutsideDomain }},
data__publishedLink = '{{ publishedLink }}',
data__md5Checksum = '{{ md5Checksum }}',
data__downloadUrl = '{{ downloadUrl }}',
data__id = '{{ id }}',
data__exportLinks = '{{ exportLinks }}',
data__kind = '{{ kind }}',
data__lastModifyingUser = '{{ lastModifyingUser }}',
data__mimeType = '{{ mimeType }}',
data__etag = '{{ etag }}',
data__selfLink = '{{ selfLink }}'
WHERE
fileId = '{{ fileId }}' --required
AND revisionId = '{{ revisionId }}' --required
RETURNING
id,
downloadUrl,
etag,
exportLinks,
fileSize,
kind,
lastModifyingUser,
lastModifyingUserName,
md5Checksum,
mimeType,
modifiedDate,
originalFilename,
pinned,
publishAuto,
published,
publishedLink,
publishedOutsideDomain,
selfLink;
DELETE examples
- delete
Permanently deletes a file version. You can only delete revisions for files with binary content, like images or videos. Revisions for other files, like Google Docs or Sheets, and the last remaining file version can't be deleted.
DELETE FROM googleworkspace.drivev2.revisions
WHERE fileId = '{{ fileId }}' --required
AND revisionId = '{{ revisionId }}' --required
;