- HTTP request
- Path parameters
- Request body
- Response body
- Authorization scopes
- ModifyLabelsRequest
- LabelModification
- FieldModification
- Try it!
Modifies the set of labels applied to a file. Returns a list of the labels that were added or modified.
HTTP request
POST https://www.googleapis.com/drive/v2/files/{fileId}/modifyLabels
The URL uses gRPC Transcoding syntax.
Path parameters
| Parameters | |
|---|---|
| fileId | 
 The ID of the file to which the labels belong. | 
Request body
The request body contains an instance of ModifyLabelsRequest.
Response body
Response to a files.modifyLabels request. This contains only those labels which were added or updated by the request.
If successful, the response body contains data with the following structure:
| JSON representation | 
|---|
| {
  "modifiedLabels": [
    {
      object ( | 
| Fields | |
|---|---|
| modifiedLabels[] | 
 The list of labels which were added or updated by the request. | 
| kind | 
 This is always  | 
Authorization scopes
Requires one of the following OAuth scopes:
- https://www.googleapis.com/auth/drive
- https://www.googleapis.com/auth/drive.file
- 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 Authorization guide.
ModifyLabelsRequest
A request to modify the set of labels on a file. This request may contain many modifications that will either all succeed or all fail atomically.
| JSON representation | 
|---|
| {
  "labelModifications": [
    {
      object ( | 
| Fields | |
|---|---|
| labelModifications[] | 
 The list of modifications to apply to the labels on the file. | 
| kind | 
 This is always  | 
LabelModification
A modification to a label on a file. A LabelModification can be used to apply a label to a file, update an existing label on a file, or remove a label from a file.
| JSON representation | 
|---|
| {
  "fieldModifications": [
    {
      object ( | 
| Fields | |
|---|---|
| fieldModifications[] | 
 The list of modifications to this label's fields. | 
| labelId | 
 The ID of the label to modify. | 
| removeLabel | 
 If true, the label will be removed from the file. | 
| kind | 
 This is always  | 
FieldModification
A modification to a label's field.
| JSON representation | 
|---|
| { "setDateValues": [ string ], "setTextValues": [ string ], "setSelectionValues": [ string ], "setIntegerValues": [ string ], "setUserValues": [ string ], "fieldId": string, "kind": string, "unsetValues": boolean } | 
| Fields | |
|---|---|
| setDateValues[] | 
 Replaces the value of a  | 
| setTextValues[] | 
 Sets the value of a  | 
| setSelectionValues[] | 
 Replaces a  | 
| setIntegerValues[] | 
 Replaces the value of an  | 
| setUserValues[] | 
 Replaces a  | 
| fieldId | 
 The ID of the field to be modified. | 
| kind | 
 This is always  | 
| unsetValues | 
 Unsets the values for this field. |