Method: files.modifyLabels
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
इस तरीके का इस्तेमाल करके, किसी फ़ाइल पर लागू किए गए लेबल के सेट में बदलाव किया जा सकता है. इससे उन लेबल की सूची मिलती है जिन्हें जोड़ा गया है या जिनमें बदलाव किया गया है.
एचटीटीपी अनुरोध
POST https://www.googleapis.com/drive/v2/files/{fileId}/modifyLabels
यह यूआरएल, gRPC ट्रांसकोडिंग सिंटैक्स का इस्तेमाल करता है.
पाथ पैरामीटर
पैरामीटर |
fileId |
string
उस फ़ाइल का आईडी जिससे लेबल जुड़े हैं.
|
अनुरोध का मुख्य भाग
अनुरोध के मुख्य भाग में 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
किसी फ़ाइल पर मौजूद लेबल के सेट में बदलाव करने का अनुरोध. इस अनुरोध में कई बदलाव शामिल हो सकते हैं. ये सभी बदलाव एक साथ लागू होंगे या एक साथ लागू नहीं होंगे.
JSON के काेड में दिखाना |
{
"labelModifications": [
{
object (LabelModification )
}
],
"kind": string
} |
फ़ील्ड |
labelModifications[] |
object (LabelModification )
फ़ाइल में मौजूद लेबल पर लागू किए जाने वाले बदलावों की सूची.
|
kind |
string
यह हमेशा drive#modifyLabelsRequest होता है.
|
LabelModification
किसी फ़ाइल के लेबल में बदलाव किया गया हो. LabelModification का इस्तेमाल, किसी फ़ाइल पर लेबल लागू करने, किसी फ़ाइल पर मौजूद लेबल को अपडेट करने या किसी फ़ाइल से लेबल हटाने के लिए किया जा सकता है.
JSON के काेड में दिखाना |
{
"fieldModifications": [
{
object (FieldModification )
}
],
"labelId": string,
"removeLabel": boolean,
"kind": string
} |
फ़ील्ड |
fieldModifications[] |
object (FieldModification )
इस लेबल के फ़ील्ड में किए गए बदलावों की सूची.
|
labelId |
string
जिस लेबल में बदलाव करना है उसका आईडी.
|
removeLabel |
boolean
अगर यह वैल्यू सही है, तो लेबल को फ़ाइल से हटा दिया जाएगा.
|
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 के पूरे तारीख वाले फ़ॉर्मैट में होनी चाहिए: YYYY-MM-DD.
|
setTextValues[] |
string
text फ़ील्ड की वैल्यू सेट करता है.
|
setSelectionValues[] |
string
यह selection फ़ील्ड को इन नई वैल्यू से बदलता है.
|
setIntegerValues[] |
string (int64 format)
integer फ़ील्ड की वैल्यू को इन नई वैल्यू से बदलता है.
|
setUserValues[] |
string
यह user फ़ील्ड को इन नई वैल्यू से बदलता है. वैल्यू, मान्य ईमेल पते होने चाहिए.
|
fieldId |
string
जिस फ़ील्ड में बदलाव करना है उसका आईडी.
|
kind |
string
यह हमेशा drive#labelFieldModification होता है.
|
unsetValues |
boolean
इस फ़ील्ड के लिए वैल्यू सेट नहीं करता है.
|
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 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. |"]]