認証が必要です
ユーザーのアカウントとコンテナの権限を更新します。 今すぐ試すまたは例を見る。
リクエスト
HTTP リクエスト
PUT https://www.googleapis.com/tagmanager/v1/accounts/accountId/permissions/permissionId
パラメータ
パラメータ名 | 値 | 説明 |
---|---|---|
パスパラメータ | ||
accountId |
string |
GTM アカウント ID。 |
permissionId |
string |
GTM ユーザー ID。 |
承認
このリクエストは、次のスコープでの承認が必要です(認証と承認の詳細をご確認ください)。
スコープ |
---|
https://www.googleapis.com/auth/tagmanager.manage.users |
リクエスト本文
リクエストの本文には、以下のプロパティを使用して Permissions リソースを指定します。
プロパティ名 | 値 | 説明 | メモ |
---|---|---|---|
省略可能なプロパティ | |||
accountAccess |
nested object |
GTM アカウントへのアクセス権。 | 書き込み可能 |
accountAccess.permission[] |
list |
アカウントのアクセス権の一覧。有効なアカウント権限は read と manage です。 |
書き込み可能 |
containerAccess[] |
list |
GTM コンテナのアクセス権。 | 書き込み可能 |
containerAccess[].containerId |
string |
GTM コンテナ ID。 | 書き込み可能 |
containerAccess[].permission[] |
list |
コンテナのアクセス権の一覧。有効なコンテナの権限は read, edit, delete, publish です。 |
書き込み可能 |
レスポンス
成功すると、このメソッドによりレスポンスの本文で Permissions リソースが返されます。
例
注: このメソッドで使用可能なコード例では、サポートされているプログラミング言語すべての例を示しているわけではありません(サポートされている言語の一覧については、クライアント ライブラリ ページをご覧ください)。
Java
Java クライアント ライブラリを使用します。
/* * 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 クライアント ライブラリを使用します。
# 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')
試してみよう:
以下の API Explorer を使用して、ライブデータに対してこのメソッドを呼び出し、レスポンスを確認してください。