Richiede l'autorizzazione
Elenca i caricamenti a cui l'utente ha accesso. Prova subito o visualizza un esempio.
Oltre ai parametri standard, questo metodo supporta quelli elencati nella tabella dei parametri.
Richiesta
Richiesta HTTP
GET https://www.googleapis.com/analytics/v3/management/accounts/accountId/webproperties/webPropertyId/customDataSources/customDataSourceId/uploads
Parametri
Nome del parametro | Valore | Descrizione |
---|---|---|
Parametri del percorso | ||
accountId |
string |
ID account da recuperare. |
customDataSourceId |
string |
ID origine dati personalizzata per il recupero dei caricamenti. |
webPropertyId |
string |
ID proprietà web per il recupero dei caricamenti. |
Parametri di query facoltativi | ||
max-results |
integer |
Il numero massimo di caricamenti da includere in questa risposta. |
start-index |
integer |
Un indice in base 1 del primo caricamento da recuperare. Utilizza questo parametro come meccanismo di impaginazione insieme al parametro max-results. |
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/analytics |
https://www.googleapis.com/auth/analytics.edit |
https://www.googleapis.com/auth/analytics.readonly |
Corpo della richiesta
Non fornire il corpo di una richiesta con questo metodo.
Risposta
Se l'esito è positivo, questo metodo restituisce un corpo della risposta con la seguente struttura:
{ "kind": "analytics#uploads", "totalResults": integer, "startIndex": integer, "itemsPerPage": integer, "previousLink": string, "nextLink": string, "items": [ management.uploads Resource ] }
Nome proprietà | Valore | Descrizione | Note |
---|---|---|---|
kind |
string |
Tipo di raccolta. | |
totalResults |
integer |
Il numero totale di risultati per la query, indipendentemente dal numero di risorse nel risultato. | |
startIndex |
integer |
L'indice iniziale delle risorse, che è 1 per impostazione predefinita o altrimenti specificato dal parametro di query start-index. | |
itemsPerPage |
integer |
Il numero massimo di risorse che la risposta può contenere, indipendentemente dal numero effettivo di risorse restituite. Il suo valore va da 1 a 1000, con un valore predefinito pari a 1000 o altrimenti specificato dal parametro di query max-results. | |
previousLink |
string |
Link alla pagina precedente per questa raccolta caricata. | |
nextLink |
string |
Link alla pagina successiva di questa raccolta caricata. | |
items[] |
list |
Un elenco dei caricamenti. |
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 Analytics service object. * See the Data Import Developer Guide for details. */ /* * Example #1: * Requests a list of all uploads for the authorized user. */ try { Uploads uploads = analytics.management().uploads().list("123456", "UA-123456-1", "122333444455555").execute(); } catch (GoogleJsonResponseException e) { System.err.println("There was a service error: " + e.getDetails().getCode() + " : " + e.getDetails().getMessage()); } /* * Example #2: * The results of the list method are stored in the uploads object. * The following code shows how to iterate through them. */ for (Upload upload : uploads.getItems()) { System.out.println("Uploads Id = " + upload.getId()); System.out.println("Upload Kind = " + upload.getKind()); System.out.println("Account Id = " + upload.getAccountId()); System.out.println("Custom Data Source Id = " + upload.getCustomDataSourceId()); System.out.println("Upload Status = " + upload.getStatus() + "\n"); }
PHP
Utilizza la libreria client PHP.
/** * Note: This code assumes you have an authorized Analytics service object. * See the Data Import Developer Guide for details. */ /** * Example #1: * Requests a list of all uploads for the authorized user. */ try { $uploads = $analytics->management_uploads->listManagementuploads('123456', 'UA-123456-1', '122333444455555'); } catch (apiServiceException $e) { print 'There was an Analytics API service error ' . $e->getCode() . ':' . $e->getMessage(); } catch (apiException $e) { print 'There was a general API error ' . $e->getCode() . ':' . $e->getMessage(); } /** * Example #2: * The results of the list method are stored in the uploads object. * The following code shows how to iterate through them. */ foreach ($uploads->getItems() as $upload) { $html = <<<HTML <pre> Upload id = {$upload->getId()} Upload kind = {$upload->getKind()} Account id = {$upload->getAccountId()} Data set id = {$upload->getCustomDataSourceId()} Upload status = {$upload->getStatus()} </pre> HTML; print $html; }
Python
Utilizza la libreria client Python.
# Note: This code assumes you have an authorized Analytics service object. # See the Uploads Dev Guide for details. # Example #1: # Requests a list of all uploads for the authorized user. try: uploads = analytics.management().uploads().list( accountId='123456', webPropertyId='UA-123456-1', customDataSourceId='ABCDEFG123abcDEF123' ).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)) # Example #2: # The results of the list method are stored in the uploads object. # The following code shows how to iterate through them. for upload in uploads.get('items', []): print 'Upload Id = %s' % upload.get('id') print 'Upload Kind = %s' % upload.get('kind') print 'Account Id = %s' % upload.get('accountId') print 'Custom Data Source Id = %s' % upload.get('customDataSourceId') print 'Upload Status = %s\n' % upload.get('status')
JavaScript
Utilizza la libreria client JavaScript.
/* * Note: This code assumes you have an authorized Analytics client object. * See the Data Import Developer Guide for details. */ /* * Example 1: * Requests a list of all Uploads for the authorized user. */ function listUploads() { var request = gapi.client.analytics.management.uploads.list({ 'accountId': '123456', 'webPropertyId': 'UA-123456-1', 'customDataSourceId': 'ABCDEFG123abcDEF123', }); request.execute(printUploads); } /* * Example 2: * The results of the list method are passed as the results object. * The following code shows how to iterate through them. */ function printUploads(results) { if (results && !results.error) { var uploads = results.items; for (var i = 0, upload; upload = uploads[i]; i++) { console.log('Upload Id: ' + upload.id); console.log('Upload Kind: ' + upload.kind); console.log('Account Id: ' + upload.accountId); console.log('Data Set Id: ' + upload.customDataSourceId); console.log('Upload Status: ' + upload.status); } } }
Prova.
Utilizza Explorer API di seguito per chiamare questo metodo sui dati in tempo reale e visualizzare la risposta. In alternativa, prova a utilizzare Explorer in modalità autonoma.