Changes: watch

Requires authorization

Subscribes to changes for a user. Try it now.

Request

HTTP request

POST https://www.googleapis.com/drive/v3/changes/watch

Parameters

Parameter name Value Description
Required query parameters
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 or to the response from the getStartPageToken method.
Optional query parameters
includeCorpusRemovals boolean Whether changes should include the file resource if the file is still accessible by the user at the time of the request, even when a file was removed from the list of changes and there will be no further change entries for this file. (Default: false)
includeRemoved boolean Whether to include changes indicating that items have been removed from the list of changes, for example by deletion or loss of access. (Default: true)
includeTeamDriveItems boolean Whether Team Drive files or changes should be included in results. (Default: false)
pageSize integer The maximum number of changes to return per page. Acceptable values are 1 to 1000, inclusive. (Default: 100)
restrictToMyDrive boolean Whether to restrict the results to changes inside the My Drive hierarchy. This omits changes to files such as those in the Application Data folder or shared files which have not been added to My Drive. (Default: false)
spaces string A comma-separated list of spaces to query within the user corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.
supportsTeamDrives boolean Whether the requesting application supports Team Drives. (Default: false)
teamDriveId string The Team Drive from which changes will be returned. If specified the change IDs will be reflective of the Team Drive; use the combined Team Drive ID and change ID as an identifier.

Authorization

This request requires authorization with at least one of the following scopes (read more about authentication and authorization).

Scope
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/drive.readonly
https://www.googleapis.com/auth/drive.metadata.readonly
https://www.googleapis.com/auth/drive.appdata
https://www.googleapis.com/auth/drive.metadata
https://www.googleapis.com/auth/drive.photos.readonly

Request body

In the request body, supply data with the following structure:

{
  "kind": "api#channel",
  "id": string,
  "resourceId": string,
  "resourceUri": string,
  "token": string,
  "expiration": long,
  "type": string,
  "address": string,
  "payload": boolean,
  "params": {
    (key): string
  }
}
Property name Value Description Notes
kind string Identifies this as a notification channel used to watch for changes to a resource. Value: the fixed string "api#channel".
id string A UUID or similar unique string that identifies this channel.
resourceId string An opaque ID that identifies the resource being watched on this channel. Stable across different API versions.
resourceUri string A version-specific identifier for the watched resource.
token string An arbitrary string delivered to the target address with each notification delivered over this channel. Optional.
expiration long Date and time of notification channel expiration, expressed as a Unix timestamp, in milliseconds. Optional.
type string The type of delivery mechanism used for this channel.
address string The address where notifications are delivered for this channel.
payload boolean A Boolean value to indicate whether payload is wanted. Optional.
params object Additional parameters controlling delivery channel behavior. Optional.
params.(key) string Declares a new parameter by name.

Response

If successful, this method returns a response body with the following structure:

{
  "kind": "api#channel",
  "id": string,
  "resourceId": string,
  "resourceUri": string,
  "token": string,
  "expiration": long,
  "type": string,
  "address": string,
  "payload": boolean,
  "params": {
    (key): string
  }
}
Property name Value Description Notes
kind string Identifies this as a notification channel used to watch for changes to a resource. Value: the fixed string "api#channel".
id string A UUID or similar unique string that identifies this channel.
resourceId string An opaque ID that identifies the resource being watched on this channel. Stable across different API versions.
resourceUri string A version-specific identifier for the watched resource.
token string An arbitrary string delivered to the target address with each notification delivered over this channel. Optional.
expiration long Date and time of notification channel expiration, expressed as a Unix timestamp, in milliseconds. Optional.
type string The type of delivery mechanism used for this channel.
address string The address where notifications are delivered for this channel.
payload boolean A Boolean value to indicate whether payload is wanted. Optional.
params object Additional parameters controlling delivery channel behavior. Optional.
params.(key) string Declares a new parameter by name.

Try it!

Use the APIs Explorer below to call this method on live data and see the response.

Send feedback about...

Drive REST API
Drive REST API