Container Versions: update

נדרשת הרשאה

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

בקשה

בקשת HTTP

PUT https://www.googleapis.com/tagmanager/v1/accounts/accountId/containers/containerId/versions/containerVersionId

פרמטרים

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

הרשאות

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

היקף
https://www.googleapis.com/auth/tagmanager.edit.containerversions

גוף הבקשה

בגוף הבקשה, מספקים משאב מסוג Container Versions את המאפיינים הבאים:

שם הנכס Value התיאור הערות
מאפיינים אופציונליים
name string השם המוצג של גרסת הקונטיינר. ניתן לכתיבה
notes string הערות משתמש לגבי אופן ההחלה של גרסה זו של כלי הקיבול. ניתן לכתיבה

תשובה

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

דוגמאות

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

Java

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

/*
 * Note: This code assumes you have an authorized tagmanager service object.
 */

/*
 * This request updates an existing container version.
 */

// Create the container version object.
ContainerVersion version = new ContainerVersion();
version.setName("Updated Container Version");
version.setNotes("This Container Version was updated.");

try {
  ContainerVersion response = tagmanager.accounts().containers().
      versions().update("123456", "54321", "2", version).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 container version
try:
  response = tagmanager.accounts().containers().versions().update(
      accountId='123456',
      containerId='54321',
      containerVersionId='2',
      body={
          'name': 'Updated Container Version',
          'notes': 'This Container Version was updated.'
      }
  ).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 שבהמשך כדי לקרוא לשיטה הזו בנתונים בזמן אמת ולראות את התגובה.