Richiede l'autorizzazione
Recupera una variabile GTM. Prova subito o guarda un esempio.
Richiesta
Richiesta HTTP
GET https://www.googleapis.com/tagmanager/v1/accounts/accountId/containers/containerId/variables/variableId
Parametri
Nome del parametro | Valore | Descrizione |
---|---|---|
Parametri del percorso | ||
accountId |
string |
L'ID account GTM. |
containerId |
string |
L'ID contenitore GTM. |
variableId |
string |
L'ID variabile GTM. |
Autorizzazione
Questa richiesta richiede l'autorizzazione con almeno uno dei seguenti ambiti (scopri di più su autenticazione e autorizzazione).
Ambito |
---|
https://www.googleapis.com/auth/tagmanager.readonly |
https://www.googleapis.com/auth/tagmanager.edit.containers |
Corpo della richiesta
Non fornire il corpo di una richiesta con questo metodo.
Risposta
In caso di esito positivo, questo metodo restituisce una risorsa Variabili 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 gets an existing variable for the authorized user. */ try { Variable variable = tagmanager.accounts(). containers().variables().get("123456", "54321", "2").execute(); } catch (GoogleJsonResponseException e) { System.err.println("There was a service error: " + e.getDetails().getCode() + " : " + e.getDetails().getMessage()); }
Python
Utilizza la libreria client Python.
# Note: This code assumes you have an authorized tagmanager service object. # This request gets an existing variable for the authorized user. try: variable = tagmanager.accounts().containers().variables().get( accountId='123456', containerId='54321', variableId='3' ).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))
Prova.
Utilizza Explorer API di seguito per chiamare questo metodo sui dati in tempo reale e visualizzare la risposta.