Accounts: update

נדרשת הרשאה

מתבצע עדכון של חשבון GTM. אפשר לנסות עכשיו או לראות דוגמה.

בקשה

בקשת HTTP

PUT https://www.googleapis.com/tagmanager/v1/accounts/accountId

פרמטרים

שם הפרמטר Value התיאור
פרמטרים של נתיב
accountId string מספר החשבון ב-GTM.
פרמטרים אופציונליים של שאילתה
fingerprint string כששולחים אותה, טביעת האצבע צריכה להתאים לטביעת האצבע של החשבון באחסון.

הרשאות

בקשה זו מחייבת הרשאה בהיקף הבא (למידע נוסף על אימות והרשאה).

היקף
https://www.googleapis.com/auth/tagmanager.manage.accounts

גוף הבקשה

בגוף הבקשה, מספקים משאב Accounts (חשבונות) עם המאפיינים הבאים:

שם הנכס Value התיאור הערות
מאפיינים אופציונליים
name string השם המוצג של החשבון. ניתן לכתיבה
shareData boolean האם החשבון משתף נתונים באופן אנונימי עם Google ועם אחרים. ניתן לכתיבה

תשובה

אם הפעולה בוצעה ללא שגיאות, השיטה הזו מחזירה משאב של חשבונות בגוף התגובה.

דוגמאות

הערה: דוגמאות הקוד הזמינות לשיטה זו לא מייצגות את כל שפות התכנות הנתמכות (רשימת השפות הנתמכות זמינה בדף של ספריות המשתמשים).

Java

משתמש בספריית הלקוח של Java.

/*
 * 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.

# 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')

רוצה לנסות?

ניתן להשתמש ב-APIs Explorer שבהמשך כדי לקרוא לשיטה הזו בנתונים בזמן אמת ולראות את התגובה.