承認が必要です
ユーザーがアクセスできるアップロードを一覧表示します。 こちらから今すぐお試しいただくか、例をご覧ください。
標準パラメータに加えて、このメソッドはパラメータ表に示されているパラメータをサポートしています。
リクエスト
HTTP リクエスト
GET https://www.googleapis.com/analytics/v3/management/accounts/accountId/webproperties/webPropertyId/customDataSources/customDataSourceId/uploads
パラメータ
パラメータ名 | 値 | 説明 |
---|---|---|
パスパラメータ | ||
accountId |
string |
取得するアップロードのアカウント ID。 |
customDataSourceId |
string |
取得するアップロードのカスタム データソース ID。 |
webPropertyId |
string |
取得するアップロードのウェブ プロパティ ID。 |
省略可能なクエリ パラメータ | ||
max-results |
integer |
このレスポンスに含めるアップロードの最大数。 |
start-index |
integer |
最初に取得するアップロードの 1 から始まるインデックス。このパラメータは、max-results パラメータと共に改ページ メカニズムとして使用します。 |
承認
このリクエストは、少なくとも以下のスコープの 1 つによって承認される必要があります(詳細については、認証と承認に関する記事をご覧ください)。
スコープ |
---|
https://www.googleapis.com/auth/analytics |
https://www.googleapis.com/auth/analytics.edit |
https://www.googleapis.com/auth/analytics.readonly |
リクエスト本文
このメソッドをリクエストの本文に含めないでください。
レスポンス
成功すると、このメソッドは次の構造を含むレスポンスの本文を返します。
{ "kind": "analytics#uploads", "totalResults": integer, "startIndex": integer, "itemsPerPage": integer, "previousLink": string, "nextLink": string, "items": [ management.uploads Resource ] }
プロパティ名 | 値 | 説明 | 備考 |
---|---|---|---|
kind |
string |
コレクション タイプ。 | |
totalResults |
integer |
クエリに対する結果の合計数。結果内のリソースの数とは関係ありません。 | |
startIndex |
integer |
リソースの開始インデックス。デフォルトでは 1 で、それ以外の場合は start-index クエリ パラメータに指定された数になります。 | |
itemsPerPage |
integer |
レスポンスに含めることができるリソースの最大数。実際に返されたリソースの数とは関係ありません。値の範囲は 1 から 1,000 です。デフォルトでは 1,000 で、それ以外の場合は max-results クエリ パラメータで指定された数になります。 | |
previousLink |
string |
このアップロード コレクションの前のページへのリンク。 | |
nextLink |
string |
このアップロード コレクションの次のページへのリンク。 | |
items[] |
list |
アップロードのリスト。 |
例
注: このメソッドで使用可能なコード例では、サポートされているプログラミング言語すべての例を示しているわけではありません(サポートされている言語の一覧については、クライアント ライブラリ ページをご覧ください)。
Java
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
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
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
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); } } }
試してみる
リアルタイムのデータでこのメソッドを呼び出してレスポンスを確認するには、以下の APIs Explorer か、スタンドアロンのテストツールをご利用ください。