Method: labels.permissions.create
Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Aktualizuje uprawnienia etykiety. Jeśli uprawnienia dla wskazanego podmiotu nie istnieją, tworzone jest uprawnienie do etykiety. W przeciwnym razie istniejące uprawnienie jest aktualizowane. Uprawnienia dotyczą całego zasobu etykiety, nie są wersjonowane i nie wymagają publikowania.
Żądanie HTTP
POST https://drivelabels.googleapis.com/v2/{parent=labels/*}/permissions
Adres URL używa składni transkodowania gRPC.
Parametry ścieżki
Parametry |
parent |
string
Wymagany. Tworzona jest nazwa zasobu etykiety nadrzędnej w uprawnieniach do etykiety. Format: labels/{label} .
|
Parametry zapytania
Parametry |
useAdminAccess |
boolean
Ustaw wartość true , aby używać danych logowania administratora użytkownika. Przed przyznaniem dostępu serwer sprawdzi, czy użytkownik jest administratorem etykiety.
|
Treść żądania
Treść żądania zawiera wystąpienie elementu LabelPermission
.
Treść odpowiedzi
Jeśli operacja się uda, treść odpowiedzi będzie zawierała nowo utworzoną instancję LabelPermission
.
Zakresy autoryzacji
Wymaga jednego z tych zakresów OAuth:
https://www.googleapis.com/auth/drive.labels
https://www.googleapis.com/auth/drive.admin.labels
Więcej informacji znajdziesz w przewodniku po autoryzacji.
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-08-05 UTC.
[null,null,["Ostatnia aktualizacja: 2025-08-05 UTC."],[],[],null,["# Method: labels.permissions.create\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\nUpdates a label's permissions. If a permission for the indicated principal doesn't exist, a label permission is created, otherwise the existing permission is updated. Permissions affect the label resource as a whole, aren't revisioned, and don't require publishing.\n\n### HTTP request\n\n`POST https://drivelabels.googleapis.com/v2/{parent=labels/*}/permissions`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|-----------------------------------------------------------------------------------------------------------------|\n| `parent` | `string` Required. The parent label resource name on the label permission is created. Format: `labels/{label}`. |\n\n### Query parameters\n\n| Parameters ||\n|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `useAdminAccess` | `boolean` Set to `true` in order to use the user's admin credentials. The server will verify the user is an admin for the label before allowing access. |\n\n### Request body\n\nThe request body contains an instance of [LabelPermission](/workspace/drive/labels/reference/rest/v2/labels.permissions#LabelPermission).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [LabelPermission](/workspace/drive/labels/reference/rest/v2/labels.permissions#LabelPermission).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/drive.labels`\n- `\n https://www.googleapis.com/auth/drive.admin.labels`\n\nFor more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]