Yetkilendirme gerektirir
Kullanıcının hesabını ve kapsayıcı izinlerini günceller. Hemen deneyin veya bir örneğe göz atın.
İstek
HTTP isteği
PUT https://www.googleapis.com/tagmanager/v1/accounts/accountId/permissions/permissionId
Parametreler
Parametre adı | Değer | Açıklama |
---|---|---|
Yol parametreleri | ||
accountId |
string |
GTM Hesap Kimliği. |
permissionId |
string |
GTM Kullanıcı Kimliği. |
Yetkilendirme
Bu istek, aşağıdaki kapsamla yetkilendirme gerektirir (kimlik doğrulama ve yetkilendirme hakkında daha fazla bilgi edinin).
Kapsam |
---|
https://www.googleapis.com/auth/tagmanager.manage.users |
İstek içeriği
İstek gövdesinde, aşağıdaki özelliklere sahip bir İzinler kaynağı sağlayın:
Mülk adı | Değer | Açıklama | Notlar |
---|---|---|---|
İsteğe Bağlı Özellikler | |||
accountAccess |
nested object |
GTM Hesabı erişim izinleri. | yazılabilir |
accountAccess.permission[] |
list |
Hesap izinlerinin listesi. Geçerli hesap izinleri read ve manage şeklindedir. |
yazılabilir |
containerAccess[] |
list |
GTM Kapsayıcı erişim izinleri. | yazılabilir |
containerAccess[].containerId |
string |
GTM Kapsayıcı Kimliği. | yazılabilir |
containerAccess[].permission[] |
list |
Kapsayıcı izinlerinin listesi. Geçerli kapsayıcı izinleri şunlardır: read, edit, delete, publish . |
yazılabilir |
Yanıt
Başarılı olursa bu yöntem, yanıt gövdesinde bir İzinler kaynağı döndürür.
Örnekler
Not: Bu yöntem için kullanıma sunulan kod örnekleri, desteklenen tüm programlama dillerini kapsamaz (Desteklenen dillerin listesi için istemci kitaplıkları sayfasını inceleyin).
Java
Java istemci kitaplığı'nı kullanmalıdır.
/* * 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
Python istemci kitaplığı'nı kullanır.
# 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')
Deneyin.
Aşağıdaki API Gezgini'ni kullanarak canlı verilerde bu yöntemi çağırın ve yanıtı görün.