Container Versions: update

Wymaga autoryzacji

Aktualizuje wersję kontenera. Wypróbuj lub zobacz przykład.

Prośba

Żądanie HTTP

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

Parametry

Nazwa parametru Wartość Opis
Parametry ścieżki
accountId string Identyfikator konta Menedżera tagów Google.
containerId string Identyfikator kontenera Menedżera tagów Google.
containerVersionId string Identyfikator wersji kontenera Menedżera tagów Google.
Opcjonalne parametry zapytania
fingerprint string Jeśli odcisk cyfrowy jest podany, musi być zgodny z odciskiem cyfrowym wersji kontenera w pamięci.

Upoważnienie

To żądanie wymaga autoryzacji z tym zakresem (więcej informacji o uwierzytelnianiu i autoryzacji).

Zakres
https://www.googleapis.com/auth/tagmanager.edit.containerversions

Treść żądania

W treści żądania podaj zasób wersji kontenera z tymi właściwościami:

nazwa usługi, Wartość Opis Uwagi
Właściwości opcjonalne
name string Wyświetlana nazwa wersji kontenera. z możliwością zapisu
notes string Uwagi użytkownika na temat tego, jak zastosować tę wersję kontenera w kontenerze. z możliwością zapisu

Odpowiedź

Jeśli operacja się uda, metoda zwróci w treści odpowiedzi zasób wersji kontenera.

Przykłady

Uwaga: dostępne dla tej metody przykłady kodu nie odzwierciedlają wszystkich obsługiwanych języków programowania. Listę obsługiwanych języków znajdziesz na stronie z bibliotekami klienta.

Java

Korzysta z biblioteki klienta 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

Używa biblioteki klienta dla języka 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')

Wypróbuj

Użyj Eksploratora interfejsów API poniżej, aby wywołać tę metodę na aktywnych danych i zobaczyć odpowiedź.