Aktualisiert die Konto- und Containerberechtigungen eines Nutzers. Probieren Sie es aus oder sehen Sie sich ein Beispiel an.
Anfragen
HTTP-Anfrage
PUT https://www.googleapis.com/tagmanager/v1/accounts/accountId/permissions/permissionId
Parameter
Parametername | Wert | Beschreibung |
---|---|---|
Pfadparameter | ||
accountId |
string |
Die Google Tag Manager-Konto-ID. |
permissionId |
string |
Die GTM-Nutzer-ID. |
Autorisierung
Für diese Anfrage ist eine Autorisierung in folgendem Bereich erforderlich. Weitere Informationen zur Authentifizierung und Autorisierung
Umfang |
---|
https://www.googleapis.com/auth/tagmanager.manage.users |
Anfragetext
Geben Sie im Anfragetext eine Ressource vom Typ "Berechtigungen" mit den folgenden Attributen an:
Property-Name | Wert | Beschreibung | Hinweise |
---|---|---|---|
Optionale Attribute | |||
accountAccess |
nested object |
Zugriffsberechtigungen für das Google Tag Manager-Konto. | Bearbeitbar |
accountAccess.permission[] |
list |
Liste der Kontoberechtigungen. Gültige Kontoberechtigungen sind read und manage . |
Bearbeitbar |
containerAccess[] |
list |
Zugriffsberechtigungen für GTM-Container. | Bearbeitbar |
containerAccess[].containerId |
string |
GTM-Container-ID | Bearbeitbar |
containerAccess[].permission[] |
list |
Liste der Containerberechtigungen. Gültige Containerberechtigungen: read, edit, delete, publish . |
Bearbeitbar |
Antwort
Bei Erfolg gibt diese Methode eine Berechtigungsressource im Antworttext zurück.
Beispiele
Hinweis: Bei den für diese Methode verfügbaren Codebeispielen sind nicht alle unterstützten Programmiersprachen vertreten. Eine Liste der unterstützten Sprachen finden Sie auf der Seite für Clientbibliotheken.
Java
Verwendet die Java-Clientbibliothek.
/* * Note: This code assumes you have an authorized tagmanager service object. */ /* * This request updates a user's permissions to access a GTM account. */ // Construct the container access object. ContainerAccess container = new ContainerAccess(); container.setContainerId("789443"); container.setPermission(Arrays.asList("read")); // Construct the account access object. AccountAccess account = new AccountAccess(); account.setPermission(Arrays.asList("read")); // Construct the user access object. UserAccess userAccess = new UserAccess(); userAccess.setEmailAddress("username@example.com"); userAccess.setAccountAccess(account); userAccess.setContainerAccess(Arrays.asList(container)); try { UserAccess response = tagmanager.accounts(). permissions().update("123456", "00123456789", userAccess).execute(); } catch (GoogleJsonResponseException e) { System.err.println("There was a service error: " + e.getDetails().getCode() + " : " + e.getDetails().getMessage()); } /* * The results of the update method are stored in the response object. * The following code shows how to access the updated name and fingerprint. */ System.out.println("Updated Name = " + response.getName()); System.out.println("Updated Fingerprint = " + response.getFingerprint());
Python
Verwendet die Python-Clientbibliothek.
# Note: This code assumes you have an authorized tagmanager service object. # This request updates a user's permissions to access a GTM account. try: response = tagmanager.accounts().permissions().update( accountId='123456', permissionId='00123456789', body={ 'emailAddress': 'username@example.com', 'accountAccess': { 'permission': [ 'read' ] }, 'containerAccess': { 'containerId': '54321', 'permission': [ 'read' ] } } ).execute() except TypeError, error: # Handle errors in constructing a query. print 'There was an error in constructing your query : %s' % error except HttpError, error: # Handle API errors. print ('There was an API error : %s : %s' % (error.resp.status, error.resp.reason)) # The results of the update method are stored in the response object. # The following code shows how to access the updated name and fingerprint. print 'Updated Name = %s' % response.get('name') print 'Updated Fingerprint = %s' % response.get('fingerprint')
Jetzt testen
Verwenden Sie den unten angegebenen APIs Explorer, um diese Methode für Livedaten aufzurufen und die Antwort einzusehen.