Method: permissions.insert
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
किसी फ़ाइल या शेयर की गई ड्राइव के लिए अनुमति डालता है.
चेतावनी: एक ही फ़ाइल पर, अनुमतियों के लिए एक साथ कई कार्रवाइयां नहीं की जा सकतीं. सिर्फ़ आखिरी अपडेट लागू होता है.
एचटीटीपी अनुरोध
POST https://www.googleapis.com/drive/v2/files/{fileId}/permissions
यूआरएल में gRPC ट्रांसकोडिंग सिंटैक्स का इस्तेमाल किया गया है.
पाथ पैरामीटर
पैरामीटर |
fileId |
string
फ़ाइल या शेयर की गई ड्राइव का आईडी.
|
क्वेरी पैरामीटर
पैरामीटर |
emailMessage |
string
सूचना वाले ईमेल में शामिल करने के लिए, पसंद के मुताबिक बनाया गया सादा टेक्स्ट मैसेज.
|
enforceSingleParent (deprecated) |
boolean
अब काम नहीं करता: ज़्यादा जानकारी के लिए, moveToNewOwnersRoot देखें.
|
moveToNewOwnersRoot |
boolean
यह पैरामीटर सिर्फ़ तब लागू होगा, जब आइटम किसी शेयर की गई ड्राइव में न हो और अनुरोध में आइटम का मालिकाना हक ट्रांसफ़र करने की कोशिश की जा रही हो. अगर इस विकल्प को true पर सेट किया जाता है, तो आइटम को नए मालिक के 'मेरी ड्राइव' रूट फ़ोल्डर में ले जाया जाएगा. साथ ही, उससे पहले के सभी पैरंट फ़ोल्डर हटा दिए जाएंगे. अगर इसे false पर सेट किया जाता है, तो माता-पिता की जानकारी में कोई बदलाव नहीं होता.
|
sendNotificationEmails |
boolean
उपयोगकर्ताओं या ग्रुप के साथ शेयर करते समय, सूचना वाले ईमेल भेजने हैं या नहीं. अगर role की वैल्यू owner है, तो इस पैरामीटर को अनदेखा कर दिया जाता है और ईमेल भेज दिया जाता है.
|
supportsAllDrives |
boolean
अनुरोध करने वाला ऐप्लिकेशन, 'मेरी ड्राइव' और शेयर की गई ड्राइव, दोनों के साथ काम करता है या नहीं.
|
supportsTeamDrives (deprecated) |
boolean
इस्तेमाल नहीं किया जा सकता: इसके बजाय, supportsAllDrives का इस्तेमाल करें.
|
useDomainAdminAccess |
boolean
डोमेन एडमिन के तौर पर अनुरोध करें. अगर इस विकल्प को 'सही' पर सेट किया जाता है, तो अनुरोध करने वाले व्यक्ति को ऐक्सेस दिया जाएगा. हालांकि, इसके लिए ज़रूरी है कि फ़ाइल आईडी पैरामीटर, शेयर की गई ड्राइव का रेफ़रंस देता हो और अनुरोध करने वाला व्यक्ति उस डोमेन का एडमिन हो जिससे शेयर की गई ड्राइव जुड़ी है.
|
enforceExpansiveAccess |
boolean
अनुरोध में, ऐक्सेस के बड़े नियमों को लागू करना है या नहीं.
|
अनुरोध का मुख्य भाग
अनुरोध के मुख्य भाग में Permission
का उदाहरण है.
जवाब का मुख्य भाग
कामयाब रहने पर, जवाब के मुख्य हिस्से में Permission
का नया इंस्टेंस शामिल किया जाता है.
अनुमति के दायरे
इसके लिए, OAuth के इनमें से किसी एक स्कोप की ज़रूरत होती है:
https://www.googleapis.com/auth/docs
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
कुछ स्कोप पर पाबंदी होती है. साथ ही, इनका इस्तेमाल करने के लिए आपके ऐप्लिकेशन को सुरक्षा से जुड़ी समीक्षा कराने की ज़रूरत होती है. ज़्यादा जानकारी के लिए, अनुमति से जुड़ी गाइड देखें.
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को 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: permissions.insert\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nInserts a permission for a file or shared drive.\n\n**Warning:** Concurrent permissions operations on the same file are not supported; only the last update is applied.\n\n### HTTP request\n\n`POST https://www.googleapis.com/drive/v2/files/{fileId}/permissions`\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 for the file or shared drive. |\n\n### Query parameters\n\n| Parameters ||\n|----------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `emailMessage` | `string` A plain text custom message to include in notification emails. |\n| `enforceSingleParent` **(deprecated)** | `boolean` Deprecated: See `moveToNewOwnersRoot` for details. |\n| `moveToNewOwnersRoot` | `boolean` This parameter will only take effect if the item is not in a shared drive and the request is attempting to transfer the ownership of the item. If set to `true`, the item will be moved to the new owner's My Drive root folder and all prior parents removed. If set to `false`, parents are not changed. |\n| `sendNotificationEmails` | `boolean` Whether to send notification emails when sharing to users or groups. This parameter is ignored and an email is sent if the `role` is `owner`. |\n| `supportsAllDrives` | `boolean` Whether the requesting application supports both My Drives and shared drives. |\n| `supportsTeamDrives` **(deprecated)** | `boolean` Deprecated: Use `supportsAllDrives` instead. |\n| `useDomainAdminAccess` | `boolean` Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs. |\n| `enforceExpansiveAccess` | `boolean` Whether the request should enforce expansive access rules. |\n\n### Request body\n\nThe request body contains an instance of [Permission](/workspace/drive/api/reference/rest/v2/permissions#Permission).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [Permission](/workspace/drive/api/reference/rest/v2/permissions#Permission).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/docs`\n- `\n https://www.googleapis.com/auth/drive`\n- `\n https://www.googleapis.com/auth/drive.file`\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)."]]