Uploads: deleteUploadData

認証が必要です

以前のアップロードに関連付けられているデータを削除します。 今すぐ試すまたは例を見る

標準パラメータに加えて、このメソッドはパラメータ表に示されているパラメータをサポートしています。

リクエスト

HTTP リクエスト

POST https://www.googleapis.com/analytics/v3/management/accounts/accountId/webproperties/webPropertyId/customDataSources/customDataSourceId/deleteUploadData

パラメータ

パラメータ名 説明
パスパラメータ
accountId string 削除するアップロードのアカウント ID。
customDataSourceId string 削除するアップロードのカスタム データソース ID。
webPropertyId string 削除するアップロードのウェブ プロパティ ID。

承認

このリクエストは、少なくとも次のうち 1 つのスコープでの承認が必要です(認証と承認の詳細をご確認ください)。

範囲
https://www.googleapis.com/auth/analytics
https://www.googleapis.com/auth/analytics.edit

リクエスト本文

リクエストの本文には、以下の構造を使用してデータを指定してください。

{
  "customDataImportUids": [
    string
  ]
}
プロパティ名 説明 メモ
customDataImportUids[] list アップロード UID のリスト。

レスポンス

成功した場合、このメソッドは空のレスポンス本文を返します。

注: このメソッドで使用可能なコード例では、サポートされているプログラミング言語すべての例を示しているわけではありません(サポートされている言語の一覧については、クライアント ライブラリ ページをご覧ください)。

Java

Java クライアント ライブラリを使用します。

/*
 * Note: This code assumes you have an authorized Analytics service object.
 * See the Data Import Developer Guide for details.
 */


// Construct a list of file ids to delete.
List<String> filesToDelete = Arrays.asList("ZYXABC123zyxabc",
    "lmnopEFGXYZ123a", "999AAA888bbb777");

// Construct the body of the Delete Request and set the file ids.
AnalyticsDataimportDeleteUploadDataRequest body = new
    AnalyticsDataimportDeleteUploadDataRequest();
body.setCustomDataImportUids(filesToDelete);

// This request deletes three uploaded files for the authorized user.
try {
  analytics.management().uploads().deleteUploadData("123456",
      "UA-123456-1", "122333444455555", body).execute();
} catch (GoogleJsonResponseException e) {
  System.err.println("There was a service error: "
      + e.getDetails().getCode() + " : "
      + e.getDetails().getMessage());
}

PHP

PHP クライアント ライブラリを使用します。

/**
 * Note: This code assumes you have an authorized Analytics service object.
 * See the Data Import Developer Guide for details.
 */

// Construct a list of upload ids to delete.
$uploadIds = array('ABBCCCDDDDEEEEE');

// Construct the body of the Delete Request and set the upload ids.
$body = new
    Google_Service_Analytics_AnalyticsDataimportDeleteUploadDataRequest();
$body->setCustomDataImportUids($uploadIds);

// This request deletes the uploads.
try {
  $uploads = $analytics->management_uploads->deleteUploadData('123456',
      'UA-123456-1', '122333444455555', $body);

} 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();
}


Python

Python クライアント ライブラリを使用します。

# Note: This code assumes you have an authorized Analytics service object.
# See the Data Import Developer Guide for details.

# This request deletes a list of uploads.
try:
  analytics.management().uploads().deleteUploadData(
      accountId='123456',
      webPropertyId='UA-123456-1',
      customDataSourceId='ABCDEFG123456abcdefg',
      body={
          'customDataImportUids': ['ZYXABC123zyxabc',
                                   'lmnopEFGXYZ123a',
                                   '999AAA888bbb777']
      }
  ).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))

JavaScript

JavaScript クライアント ライブラリを使用します。

/*
 * Note: This code assumes you have an authorized Analytics client object.
 * See the Data Import Developer Guide for details.
 */

/*
 * This request deletes a list of existing uploads.
 */
function deleteUploads() {
  var request = gapi.client.analytics.management.uploads.deleteUploadData({
    'accountId': '123456',
    'webPropertyId': 'UA-123456-1',
    'customDataSourceId': 'ABCDEFG123abcDEF123',
    'resource': {
      'customDataImportUids': ['AAABBBCCCDDD111222',
                               'xLh4wXtzQT6uxe-_OWelog']
    }
  });
  request.execute(function (response) { // Handle the response. });
}

試してみよう:

以下の API Explorer を使用して、ライブデータに対してこのメソッドを呼び出し、レスポンスを確認してください。 または、スタンドアロンの Explorer をお試しください。