Files: listLabels

Lists the labels on a file. Try it now.

Request

HTTP request

GET https://www.googleapis.com/drive/v3/files/fileId/listLabels

Parameters

Parameter name Value Description
Path parameters
fileId string The ID of the file.
Optional query parameters
maxResults integer The maximum number of labels to return per page. When not set, this defaults to 100. Acceptable values are 1 to 100, inclusive. (Default: 100)
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.

Authorization

This request requires authorization with at least one of the following scopes:

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

Some scopes are restricted and require a security assessment for your app to use them. For more information, see the authentication and authorization page.

Request body

Do not supply a request body with this method.

Response

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

{
  "kind": "drive#labelList",
  "nextPageToken": string,
  "labels": [
    {
      "kind": "drive#label",
      "id": string,
      "revisionId": string,
      "fields": {
        (key): {
          "kind": "drive#labelField",
          "id": string,
          "valueType": string,
          "dateString": [
            date
          ],
          "integer": [
            long
          ],
          "selection": [
            string
          ],
          "text": [
            string
          ],
          "user": [
            {
              "kind": "drive#user",
              "displayName": string,
              "photoLink": string,
              "me": boolean,
              "permissionId": string,
              "emailAddress": string
            }
          ]
        }
      }
    }
  ]
}
Property name Value Description Notes
kind string This is always drive#labelList
nextPageToken string The page token for the next page of labels. This field will be absent if the end of the 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.
labels[] list The list of labels.
labels[].kind string This is always drive#label
labels[].id string The ID of the label.
labels[].revisionId string The revision ID of the label.
labels[].fields object A map of the label's fields keyed by the field ID.
labels[].fields.(key) nested object
labels[].fields.(key).kind string This is always drive#labelField.
labels[].fields.(key).id string The identifier of this field.
labels[].fields.(key).valueType string The field type. While new values may be supported in the future, the following are currently allowed:
  • dateString
  • integer
  • selection
  • text
  • user
labels[].fields.(key).dateString[] list Only present if valueType is dateString. RFC 3339 formatted date: YYYY-MM-DD.
labels[].fields.(key).integer[] list Only present if valueType is integer.
labels[].fields.(key).selection[] list Only present if valueType is selection.
labels[].fields.(key).text[] list Only present if valueType is text.
labels[].fields.(key).user[] list Only present if valueType is user.
labels[].fields.(key).user[].kind string Identifies what kind of resource this is. Value: the fixed string "drive#user".
labels[].fields.(key).user[].displayName string A plain text displayable name for this user.
labels[].fields.(key).user[].me boolean Whether this user is the requesting user.
labels[].fields.(key).user[].permissionId string The user's ID as visible in Permission resources.
labels[].fields.(key).user[].emailAddress 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.

Try it!

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