Richiede l'autorizzazione
Aggiorna un account GTM. Prova subito o guarda un esempio.
Richiesta
Richiesta HTTP
PUT https://www.googleapis.com/tagmanager/v1/accounts/accountId
Parametri
Nome del parametro | Valore | Descrizione |
---|---|---|
Parametri del percorso | ||
accountId |
string |
L'ID account GTM. |
Parametri di query facoltativi | ||
fingerprint |
string |
Se fornita, questa impronta deve corrispondere a quella dell'account 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.manage.accounts |
Corpo della richiesta
Nel corpo della richiesta, fornisci una risorsa Account con le seguenti proprietà:
Nome proprietà | Valore | Descrizione | Note |
---|---|---|---|
Proprietà facoltative | |||
name |
string |
Nome visualizzato dell'account. | scrivibile |
shareData |
boolean |
Indica se l'account condivide i dati in modo anonimo con Google e altri. | scrivibile |
Risposta
In caso di esito positivo, questo metodo restituisce una risorsa Account 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 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
Utilizza la libreria client 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')
Prova.
Utilizza Explorer API di seguito per chiamare questo metodo sui dati in tempo reale e visualizzare la risposta.