Files: listLabels

Stay organized with collections Save and categorize content based on your preferences.

Lists the labels on a file. Try it now.

Request

HTTP request

GET https://www.googleapis.com/drive/v2/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,
  "items": [
    {
      "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,
              "picture": {
                "url": string
              },
              "isAuthenticatedUser": 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.
items[] list The list of labels.
items[].kind string This is always drive#label
items[].id string The ID of the label.
items[].revisionId string The revision ID of the label.
items[].fields object A map of the label's fields keyed by the field ID.
items[].fields.(key) nested object
items[].fields.(key).kind string This is always drive#labelField.
items[].fields.(key).id string The identifier of this field.
items[].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
items[].fields.(key).dateString[] list Only present if valueType is dateString. RFC 3339 formatted date: YYYY-MM-DD.
items[].fields.(key).integer[] list Only present if valueType is integer.
items[].fields.(key).selection[] list Only present if valueType is selection.
items[].fields.(key).text[] list Only present if valueType is text.
items[].fields.(key).user[] list Only present if valueType is user.
items[].fields.(key).user[].kind string This is always drive#user.
items[].fields.(key).user[].displayName string A plain text displayable name for this user.
items[].fields.(key).user[].picture object The user's profile picture.
items[].fields.(key).user[].picture.url string A URL that points to a profile picture of this user.
items[].fields.(key).user[].isAuthenticatedUser boolean Whether this user is the same as the authenticated user for whom the request was made.
items[].fields.(key).user[].permissionId string The user's ID as visible in the permissions collection.
items[].fields.(key).user[].emailAddress string The email address of the user.

Try it!

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