Uploads: list

يجب تقديم تفويض.

إدراج عمليات التحميل التي يمكن للمستخدم الوصول إليها جرِّبه الآن أو اطّلِع على مثال.

وبالإضافة إلى المَعلمات العادية، تتيح هذه الطريقة استخدام المَعلمات المدرَجة في جدول المَعلمات.

الطلب

طلب HTTP

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

المَعلمات

اسم المعلَمة القيمة الوصف
مَعلمات المسار
accountId string رقم تعريف الحساب لعمليات التحميل لاستردادها.
customDataSourceId string رقم تعريف مصدر البيانات المخصّص لعمليات التحميل لاستردادها.
webPropertyId string رقم تعريف الموقع الإلكتروني لعمليات التحميل لاستردادها.
مَعلمات طلب البحث الاختيارية
max-results integer تمثّل هذه السمة الحد الأقصى لعدد عمليات التحميل التي يمكن تضمينها في هذا الردّ.
start-index integer فهرس مستند إلى 1 لعملية التحميل الأولى المطلوب استردادها. يمكنك استخدام هذه المَعلمة كآلية تقسيم على صفحات إلى جانب المَعلمة max-results.

التفويض

يتطلب هذا الطلب تفويضًا باستخدام نطاق واحد على الأقل من النطاقات التالية (مزيد من المعلومات عن المصادقة والترخيص).

النطاق
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
  ]
}
اسم الموقع القيمة الوصف Notes
kind string نوع المجموعة
totalResults integer إجمالي عدد النتائج لطلب البحث، بغض النظر عن عدد الموارد في النتيجة.
startIndex integer هو فهرس البدء للموارد، والذي يكون 1 تلقائيًا، أو يتم تحديده بطريقة أخرى من خلال مَعلمة طلب البحث لفهرس البدء.
itemsPerPage integer الحد الأقصى لعدد الموارد التي يمكن أن يحتوي عليها الرد، بغض النظر عن العدد الفعلي للموارد المعروضة. تتراوح قيمتها من 1 إلى 1000 مع قيمة تبلغ 1000 تلقائيًا، أو يتم تحديدها من خلال مَعلمة طلب البحث max-results.
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);
    }
  }
}

تجربة

استخدِم مستكشف واجهات برمجة التطبيقات أدناه لطلب هذه الطريقة على البيانات المباشرة والاطّلاع على الردّ. ويمكنك بدلاً من ذلك تجربة المستكشف المستقل.