Accounts: update

Yetkilendirme gerektirir

Bir GTM hesabını 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

Parametreler

Parametre adı Değer Açıklama
Yol parametreleri
accountId string GTM Hesap Kimliği.
İsteğe bağlı sorgu parametreleri
fingerprint string Sağlandığında bu parmak izi, depolama alanındaki hesabın parmak iziyle eşleşmelidir.

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.accounts

İstek içeriği

İstek gövdesinde, aşağıdaki özelliklere sahip bir Hesaplar kaynağı sağlayın:

Mülk adı Değer Açıklama Notlar
İsteğe Bağlı Özellikler
name string Görünen hesap adı. yazılabilir
shareData boolean Hesabın Google ve başkalarıyla anonim olarak veri paylaşıp paylaşmadığı. yazılabilir

Yanıt

Başarılı olursa bu yöntem, yanıt gövdesinde bir Hesaplar 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 an existing account for the authorized user.
 */

// Construct the account object
Account account = new Account();
account.setName("Primary GTM Account");
account.setShareData(false);

try {
  Account response = tagmanager.accounts().update("123456", account).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 an existing account for the authorized user.
try:
  response = tagmanager.accounts().update(
      accountId='123456',
      body={
          'name': 'Primary GTM Account',
          'shareData': False
      }
  ).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.