Autorisation requise
Met à jour un compte GTM. Essayez maintenant ou consultez un exemple.
Requête
Requête HTTP
PUT https://www.googleapis.com/tagmanager/v1/accounts/accountId
Paramètres
Nom du paramètre | Valeur | Description |
---|---|---|
Paramètres de chemin d'accès | ||
accountId |
string |
ID du compte GTM. |
Paramètres de requête facultatifs | ||
fingerprint |
string |
Lorsqu'elle est fournie, cette empreinte doit correspondre à l'empreinte du compte dans l'espace de stockage. |
Autorisation
Une autorisation est requise pour cette requête. Celle-ci doit inclure le champ d'application suivant (en savoir plus sur le processus d'authentification et d'autorisation).
Définition du champ d'application |
---|
https://www.googleapis.com/auth/tagmanager.manage.accounts |
Corps de la requête
Dans le corps de la requête, indiquez une ressource "Accounts" avec les propriétés suivantes:
Nom de propriété | Valeur | Description | Remarques |
---|---|---|---|
Propriétés facultatives | |||
name |
string |
Nom à afficher pour le compte. | accessible en écriture |
shareData |
boolean |
Indique si le compte partage des données de manière anonyme avec Google et d'autres services. | accessible en écriture |
Réponse
Lorsque cette méthode fonctionne, elle renvoie une ressource "Accounts" dans le corps de réponse.
Exemples
Remarque : Les langages de programmation compatibles ne figurent pas tous dans les exemples de code présentés pour cette méthode (consultez la page Bibliothèques clientes pour obtenir la liste des langages compatibles).
Java
Utilise la bibliothèque cliente 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
Utilise la bibliothèque cliente 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')
Essayer
Utilisez l'explorateur d'API ci-dessous pour appeler cette méthode sur des données en direct, puis observez la réponse.