Container Versions: update

Richiede l'autorizzazione

Aggiorna la versione di un contenitore. Prova subito o guarda un esempio.

Richiesta

Richiesta HTTP

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

Parametri

Nome del parametro Valore Descrizione
Parametri del percorso
accountId string L'ID account GTM.
containerId string L'ID contenitore GTM.
containerVersionId string L'ID versione del contenitore GTM.
Parametri di query facoltativi
fingerprint string Se fornita, questa impronta deve corrispondere a quella della versione del contenitore nello spazio di archiviazione.

Autorizzazione

Questa richiesta richiede l'autorizzazione con il seguente ambito (scopri di più su autenticazione e autorizzazione).

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

Corpo della richiesta

Nel corpo della richiesta, fornisci una risorsa Versioni contenitore con le seguenti proprietà:

Nome proprietà Valore Descrizione Note
Proprietà facoltative
name string Nome visualizzato della versione del contenitore. scrivibile
notes string Note dell'utente su come applicare questa versione del contenitore nel contenitore. scrivibile

Risposta

In caso di esito positivo, questo metodo restituisce una risorsa Versioni contenitore nel corpo della risposta.

Esempi

Nota: gli esempi di codice disponibili per questo metodo non rappresentano tutti i linguaggi di programmazione supportati (consulta la pagina relativa alle librerie client per un elenco dei linguaggi supportati).

Java

Utilizza la libreria client 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

Utilizza la libreria client 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')

Prova.

Utilizza Explorer API di seguito per chiamare questo metodo sui dati in tempo reale e visualizzare la risposta.