Requires authorization
List uploads to which the user has access. Try it now or see an example.
In addition to the standard parameters, this method supports the parameters listed in the parameters table.
Request
HTTP request
GET https://www.googleapis.com/analytics/v3/management/accounts/accountId/webproperties/webPropertyId/customDataSources/customDataSourceId/uploads
Parameters
Parameter name | Value | Description |
---|---|---|
Path parameters | ||
accountId |
string |
Account Id for the uploads to retrieve. |
customDataSourceId |
string |
Custom data source Id for uploads to retrieve. |
webPropertyId |
string |
Web property Id for the uploads to retrieve. |
Optional query parameters | ||
max-results |
integer |
The maximum number of uploads to include in this response. |
start-index |
integer |
A 1-based index of the first upload to retrieve. Use this parameter as a pagination mechanism along with the max-results parameter. |
Authorization
This request requires authorization with at least one of the following scopes (read more about authentication and authorization).
Scope |
---|
https://www.googleapis.com/auth/analytics |
https://www.googleapis.com/auth/analytics.edit |
https://www.googleapis.com/auth/analytics.readonly |
Request body
Do not supply a request body with this method.
Response
If successful, this method returns a response body with the following structure:
{ "kind": "analytics#uploads", "totalResults": integer, "startIndex": integer, "itemsPerPage": integer, "previousLink": string, "nextLink": string, "items": [ management.uploads Resource ] }
Property name | Value | Description | Notes |
---|---|---|---|
kind |
string |
Collection type. | |
totalResults |
integer |
The total number of results for the query, regardless of the number of resources in the result. | |
startIndex |
integer |
The starting index of the resources, which is 1 by default or otherwise specified by the start-index query parameter. | |
itemsPerPage |
integer |
The maximum number of resources the response can contain, regardless of the actual number of resources returned. Its value ranges from 1 to 1000 with a value of 1000 by default, or otherwise specified by the max-results query parameter. | |
previousLink |
string |
Link to previous page for this upload collection. | |
nextLink |
string |
Link to next page for this upload collection. | |
items[] |
list |
A list of uploads. |
Examples
Note: The code examples available for this method do not represent all supported programming languages (see the client libraries page for a list of supported languages).
Java
Uses the Java client library.
/* * 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
Uses the PHP client library.
/** * 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
Uses the Python client library.
# 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
Uses the JavaScript client library.
/* * 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); } } }
Try it!
Use the APIs Explorer below to call this method on live data and see the response. Alternatively, try the standalone Explorer.