# Drive API . revisions

## Instance Methods

Close httplib2 connections.

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.

Gets a revision's metadata or content by ID.

Gets a revision's metadata or content by ID.

Lists a file's revisions.

Retrieves the next page of results.

Updates a revision with patch semantics.

### Method Details

`close()`

    Close httplib2 connections.

`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.

    Args:
      fileId: string, The ID of the file. (required)
      revisionId: string, The ID of the revision. (required)

`get(fileId, revisionId, acknowledgeAbuse=None)`

    Gets a revision's metadata or content by ID.

    Args:
      fileId: string, The ID of the file. (required)
      revisionId: string, The ID of the revision. (required)
      acknowledgeAbuse: boolean, Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.

    Returns:
      An object of the form:

        { # The metadata for a revision to a file.
      "exportLinks": { # Links for exporting Docs Editors files to specific formats.
        "a_key": "A String", # A mapping from export format to URL
      },
      "id": "A String", # The ID of the revision.
      "keepForever": True or False, # 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": "drive#revision", # Identifies what kind of resource this is. Value: the fixed string "drive#revision".
      "lastModifyingUser": { # Information about a Drive user. # The last user to modify this revision.
        "displayName": "A String", # A plain text displayable name for this user.
        "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
        "kind": "drive#user", # Identifies what kind of resource this is. Value: the fixed string "drive#user".
        "me": True or False, # Whether this user is the requesting user.
        "permissionId": "A String", # The user's ID as visible in Permission resources.
        "photoLink": "A String", # A link to the user's profile photo, if available.
      },
      "md5Checksum": "A String", # The MD5 checksum of the revision's content. This is only applicable to files with binary content in Drive.
      "mimeType": "A String", # The MIME type of the revision.
      "modifiedTime": "A String", # The last time the revision was modified (RFC 3339 date-time).
      "originalFilename": "A String", # The original filename used to create this revision. This is only applicable to files with binary content in Drive.
      "publishAuto": True or False, # Whether subsequent revisions will be automatically republished. This is only applicable to Docs Editors files.
      "published": True or False, # Whether this revision is published. This is only applicable to Docs Editors files.
      "publishedLink": "A String", # A link to the published revision. This is only populated for Google Sites files.
      "publishedOutsideDomain": True or False, # Whether this revision is published outside the domain. This is only applicable to Docs Editors files.
      "size": "A String", # The size of the revision's content in bytes. This is only applicable to files with binary content in Drive.
    }

`get_media(fileId, revisionId, acknowledgeAbuse=None)`

    Gets a revision's metadata or content by ID.

    Args:
      fileId: string, The ID of the file. (required)
      revisionId: string, The ID of the revision. (required)
      acknowledgeAbuse: boolean, Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.

    Returns:
      The media object as a string.

`list(fileId, pageSize=None, pageToken=None)`

    Lists a file's revisions.

    Args:
      fileId: string, The ID of the file. (required)
      pageSize: integer, The maximum number of revisions to return per page.
      pageToken: string, The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response.

    Returns:
      An object of the form:

        { # A list of revisions of a file.
      "kind": "drive#revisionList", # Identifies what kind of resource this is. Value: the fixed string "drive#revisionList".
      "nextPageToken": "A String", # The page token for the next page of revisions. This will be absent if the end of the revisions list has been reached. If the token is rejected for any reason, it should be discarded, and pagination should be restarted from the first page of results.
      "revisions": [ # The list of revisions. If nextPageToken is populated, then this list may be incomplete and an additional page of results should be fetched.
        { # The metadata for a revision to a file.
          "exportLinks": { # Links for exporting Docs Editors files to specific formats.
            "a_key": "A String", # A mapping from export format to URL
          },
          "id": "A String", # The ID of the revision.
          "keepForever": True or False, # 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": "drive#revision", # Identifies what kind of resource this is. Value: the fixed string "drive#revision".
          "lastModifyingUser": { # Information about a Drive user. # The last user to modify this revision.
            "displayName": "A String", # A plain text displayable name for this user.
            "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
            "kind": "drive#user", # Identifies what kind of resource this is. Value: the fixed string "drive#user".
            "me": True or False, # Whether this user is the requesting user.
            "permissionId": "A String", # The user's ID as visible in Permission resources.
            "photoLink": "A String", # A link to the user's profile photo, if available.
          },
          "md5Checksum": "A String", # The MD5 checksum of the revision's content. This is only applicable to files with binary content in Drive.
          "mimeType": "A String", # The MIME type of the revision.
          "modifiedTime": "A String", # The last time the revision was modified (RFC 3339 date-time).
          "originalFilename": "A String", # The original filename used to create this revision. This is only applicable to files with binary content in Drive.
          "publishAuto": True or False, # Whether subsequent revisions will be automatically republished. This is only applicable to Docs Editors files.
          "published": True or False, # Whether this revision is published. This is only applicable to Docs Editors files.
          "publishedLink": "A String", # A link to the published revision. This is only populated for Google Sites files.
          "publishedOutsideDomain": True or False, # Whether this revision is published outside the domain. This is only applicable to Docs Editors files.
          "size": "A String", # The size of the revision's content in bytes. This is only applicable to files with binary content in Drive.
        },
      ],
    }

`list_next(previous_request, previous_response)`

    Retrieves the next page of results.

    Args:
      previous_request: The request for the previous page. (required)
      previous_response: The response from the request for the previous page. (required)

    Returns:
      A request object that you can call 'execute()' on to request the next
      page. Returns None if there are no more items in the collection.

`update(fileId, revisionId, body=None)`

    Updates a revision with patch semantics.

    Args:
      fileId: string, The ID of the file. (required)
      revisionId: string, The ID of the revision. (required)
      body: object, The request body.
        The object takes the form of:

    { # The metadata for a revision to a file.
      "exportLinks": { # Links for exporting Docs Editors files to specific formats.
        "a_key": "A String", # A mapping from export format to URL
      },
      "id": "A String", # The ID of the revision.
      "keepForever": True or False, # 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": "drive#revision", # Identifies what kind of resource this is. Value: the fixed string "drive#revision".
      "lastModifyingUser": { # Information about a Drive user. # The last user to modify this revision.
        "displayName": "A String", # A plain text displayable name for this user.
        "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
        "kind": "drive#user", # Identifies what kind of resource this is. Value: the fixed string "drive#user".
        "me": True or False, # Whether this user is the requesting user.
        "permissionId": "A String", # The user's ID as visible in Permission resources.
        "photoLink": "A String", # A link to the user's profile photo, if available.
      },
      "md5Checksum": "A String", # The MD5 checksum of the revision's content. This is only applicable to files with binary content in Drive.
      "mimeType": "A String", # The MIME type of the revision.
      "modifiedTime": "A String", # The last time the revision was modified (RFC 3339 date-time).
      "originalFilename": "A String", # The original filename used to create this revision. This is only applicable to files with binary content in Drive.
      "publishAuto": True or False, # Whether subsequent revisions will be automatically republished. This is only applicable to Docs Editors files.
      "published": True or False, # Whether this revision is published. This is only applicable to Docs Editors files.
      "publishedLink": "A String", # A link to the published revision. This is only populated for Google Sites files.
      "publishedOutsideDomain": True or False, # Whether this revision is published outside the domain. This is only applicable to Docs Editors files.
      "size": "A String", # The size of the revision's content in bytes. This is only applicable to files with binary content in Drive.
    }

    Returns:
      An object of the form:

        { # The metadata for a revision to a file.
      "exportLinks": { # Links for exporting Docs Editors files to specific formats.
        "a_key": "A String", # A mapping from export format to URL
      },
      "id": "A String", # The ID of the revision.
      "keepForever": True or False, # 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": "drive#revision", # Identifies what kind of resource this is. Value: the fixed string "drive#revision".
      "lastModifyingUser": { # Information about a Drive user. # The last user to modify this revision.
        "displayName": "A String", # A plain text displayable name for this user.
        "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
        "kind": "drive#user", # Identifies what kind of resource this is. Value: the fixed string "drive#user".
        "me": True or False, # Whether this user is the requesting user.
        "permissionId": "A String", # The user's ID as visible in Permission resources.
        "photoLink": "A String", # A link to the user's profile photo, if available.
      },
      "md5Checksum": "A String", # The MD5 checksum of the revision's content. This is only applicable to files with binary content in Drive.
      "mimeType": "A String", # The MIME type of the revision.
      "modifiedTime": "A String", # The last time the revision was modified (RFC 3339 date-time).
      "originalFilename": "A String", # The original filename used to create this revision. This is only applicable to files with binary content in Drive.
      "publishAuto": True or False, # Whether subsequent revisions will be automatically republished. This is only applicable to Docs Editors files.
      "published": True or False, # Whether this revision is published. This is only applicable to Docs Editors files.
      "publishedLink": "A String", # A link to the published revision. This is only populated for Google Sites files.
      "publishedOutsideDomain": True or False, # Whether this revision is published outside the domain. This is only applicable to Docs Editors files.
      "size": "A String", # The size of the revision's content in bytes. This is only applicable to files with binary content in Drive.
    }