Method: files.modifyLabels
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
파일에 적용된 라벨 집합을 수정합니다. 추가되거나 수정된 라벨 목록을 반환합니다.
HTTP 요청
POST https://www.googleapis.com/drive/v2/files/{fileId}/modifyLabels
URL은 gRPC 트랜스코딩 문법을 사용합니다.
경로 매개변수
매개변수 |
fileId |
string
라벨이 속한 파일의 ID입니다.
|
요청 본문
요청 본문에 ModifyLabelsRequest
의 인스턴스가 포함됩니다.
응답 본문
files.modifyLabels 요청에 대한 응답입니다. 여기에는 요청에 의해 추가되거나 업데이트된 라벨만 포함됩니다.
성공한 경우 응답 본문은 다음과 같은 구조의 데이터를 포함합니다.
JSON 표현 |
{
"modifiedLabels": [
{
object (Label )
}
],
"kind": string
} |
필드 |
modifiedLabels[] |
object (Label )
요청에 의해 추가되거나 업데이트된 라벨 목록입니다.
|
kind |
string
항상 drive#modifyLabelsResponse 입니다.
|
승인 범위
다음 OAuth 범위 중 하나가 필요합니다.
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/drive.metadata
일부 범위는 제한되어 있으며 앱에서 이를 사용하려면 보안 평가가 필요합니다. 자세한 내용은 승인 가이드를 참고하세요.
ModifyLabelsRequest
파일의 라벨 집합을 수정하기 위한 요청입니다. 이 요청에는 원자적으로 모두 성공하거나 모두 실패하는 여러 수정사항이 포함될 수 있습니다.
필드 |
labelModifications[] |
object (LabelModification )
파일의 라벨에 적용할 수정사항 목록입니다.
|
kind |
string
항상 drive#modifyLabelsRequest 입니다.
|
LabelModification
파일의 라벨 수정입니다. LabelModification은 파일에 라벨을 적용하거나, 파일의 기존 라벨을 업데이트하거나, 파일에서 라벨을 삭제하는 데 사용할 수 있습니다.
JSON 표현 |
{
"fieldModifications": [
{
object (FieldModification )
}
],
"labelId": string,
"removeLabel": boolean,
"kind": string
} |
필드 |
fieldModifications[] |
object (FieldModification )
이 라벨의 필드에 대한 수정사항 목록입니다.
|
labelId |
string
수정할 라벨의 ID입니다.
|
removeLabel |
boolean
true인 경우 라벨이 파일에서 삭제됩니다.
|
kind |
string
항상 drive#labelModification 입니다.
|
FieldModification
JSON 표현 |
{
"setDateValues": [
string
],
"setTextValues": [
string
],
"setSelectionValues": [
string
],
"setIntegerValues": [
string
],
"setUserValues": [
string
],
"fieldId": string,
"kind": string,
"unsetValues": boolean
} |
필드 |
setDateValues[] |
string
date 필드의 값을 이러한 새 값으로 바꿉니다. 문자열은 RFC 3339 full-date 형식(YYYY-MM-DD)이어야 합니다.
|
setTextValues[] |
string
text 필드의 값을 설정합니다.
|
setSelectionValues[] |
string
selection 필드를 이러한 새 값으로 바꿉니다.
|
setIntegerValues[] |
string (int64 format)
integer 필드의 값을 이러한 새 값으로 바꿉니다.
|
setUserValues[] |
string
user 필드를 이러한 새 값으로 바꿉니다. 값은 유효한 이메일 주소여야 합니다.
|
fieldId |
string
수정할 필드의 ID입니다.
|
kind |
string
항상 drive#labelFieldModification 입니다.
|
unsetValues |
boolean
이 필드의 값을 설정 해제합니다.
|
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-25(UTC)
[null,null,["최종 업데이트: 2025-07-25(UTC)"],[],[],null,["# Method: files.modifyLabels\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n - [JSON representation](#body.ModifyLabelsResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [ModifyLabelsRequest](#ModifyLabelsRequest)\n - [JSON representation](#ModifyLabelsRequest.SCHEMA_REPRESENTATION)\n- [LabelModification](#LabelModification)\n - [JSON representation](#LabelModification.SCHEMA_REPRESENTATION)\n- [FieldModification](#FieldModification)\n - [JSON representation](#FieldModification.SCHEMA_REPRESENTATION)\n- [Try it!](#try-it)\n\nModifies the set of labels applied to a file. Returns a list of the labels that were added or modified.\n\n### HTTP request\n\n`POST https://www.googleapis.com/drive/v2/files/{fileId}/modifyLabels`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|---------------------------------------------------------|\n| `fileId` | `string` The ID of the file to which the labels belong. |\n\n### Request body\n\nThe request body contains an instance of [ModifyLabelsRequest](/workspace/drive/api/reference/rest/v2/files/modifyLabels#ModifyLabelsRequest).\n\n### Response body\n\nResponse to a files.modifyLabels request. This contains only those labels which were added or updated by the request.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|-------------------------------------------------------------------------------------------------------------|\n| ``` { \"modifiedLabels\": [ { object (/workspace/drive/api/reference/rest/v2/Label) } ], \"kind\": string } ``` |\n\n| Fields ||\n|--------------------|-----------------------------------------------------------------------------------------------------------------------------------|\n| `modifiedLabels[]` | `object (`[Label](/workspace/drive/api/reference/rest/v2/Label)`)` The list of labels which were added or updated by the request. |\n| `kind` | `string` This is always `drive#modifyLabelsResponse` |\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/drive`\n- `\n https://www.googleapis.com/auth/drive.file`\n- `\n https://www.googleapis.com/auth/drive.metadata`\n\nSome scopes are restricted and require a security assessment for your app to use them. For more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent).\n\nModifyLabelsRequest\n-------------------\n\nA 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.\n\n| JSON representation |\n|------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"labelModifications\": [ { object (/workspace/drive/api/reference/rest/v2/files/modifyLabels#LabelModification) } ], \"kind\": string } ``` |\n\n| Fields ||\n|------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `labelModifications[]` | `object (`[LabelModification](/workspace/drive/api/reference/rest/v2/files/modifyLabels#LabelModification)`)` The list of modifications to apply to the labels on the file. |\n| `kind` | `string` This is always `drive#modifyLabelsRequest`. |\n\nLabelModification\n-----------------\n\nA 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.\n\n| JSON representation |\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"fieldModifications\": [ { object (/workspace/drive/api/reference/rest/v2/files/modifyLabels#FieldModification) } ], \"labelId\": string, \"removeLabel\": boolean, \"kind\": string } ``` |\n\n| Fields ||\n|------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `fieldModifications[]` | `object (`[FieldModification](/workspace/drive/api/reference/rest/v2/files/modifyLabels#FieldModification)`)` The list of modifications to this label's fields. |\n| `labelId` | `string` The ID of the label to modify. |\n| `removeLabel` | `boolean` If true, the label will be removed from the file. |\n| `kind` | `string` This is always `drive#labelModification`. |\n\nFieldModification\n-----------------\n\nA modification to a label's field.\n\n| JSON representation |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"setDateValues\": [ string ], \"setTextValues\": [ string ], \"setSelectionValues\": [ string ], \"setIntegerValues\": [ string ], \"setUserValues\": [ string ], \"fieldId\": string, \"kind\": string, \"unsetValues\": boolean } ``` |\n\n| Fields ||\n|------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|\n| `setDateValues[]` | `string` Replaces the value of a `date` field with these new values. The string must be in the RFC 3339 full-date format: YYYY-MM-DD. |\n| `setTextValues[]` | `string` Sets the value of a `text` field. |\n| `setSelectionValues[]` | `string` Replaces a `selection` field with these new values. |\n| `setIntegerValues[]` | `string (`[int64](https://developers.google.com/discovery/v1/type-format)` format)` Replaces the value of an `integer` field with these new values. |\n| `setUserValues[]` | `string` Replaces a `user` field with these new values. The values must be valid email addresses. |\n| `fieldId` | `string` The ID of the field to be modified. |\n| `kind` | `string` This is always `drive#labelFieldModification`. |\n| `unsetValues` | `boolean` Unsets the values for this field. |"]]