يجب تقديم تفويض
سرد عمليات التحميل التي يمكن للمستخدم الوصول إليها جرِّبه الآن أو شاهد مثالاً.
بالإضافة إلى المَعلمات العادية، تتيح هذه الطريقة المَعلمات الواردة في جدول المَعلمات.
الطلب
طلب 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 |
فهرس مستند إلى واحد لأول عملية تحميل لاستردادها. يمكنك استخدام هذه المَعلمة كآلية تقسيم على عدّة صفحات مع المَعلمة 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 مع ضبط القيمة على 1, 000 تلقائيًا، أو تحديدها بطريقة أخرى من خلال مَعلمة طلب البحث عن الحد الأقصى للنتائج. | |
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); } } }
تجربة
يمكنك استخدام مستكشف واجهات برمجة التطبيقات أدناه لطلب هذه الطريقة على البيانات المباشرة والاطّلاع على الاستجابة. ويمكنك بدلاً من ذلك تجربة المستكشف المستقل.