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
  ]
}
שם הנכס תמורה לכסף תיאור הערות
kind string סוג האוסף.
totalResults integer המספר הכולל של התוצאות לשאילתה, ללא קשר למספר המשאבים שהתקבל בתוצאה.
startIndex integer אינדקס ההתחלה של המשאבים, שהוא 1 כברירת מחדל או שצוין אחרת על ידי פרמטר השאילתה start-index.
itemsPerPage integer המספר המקסימלי של משאבים שהתגובה יכולה להכיל, ללא קשר למספר המשאבים שהוחזרו בפועל. הערך שלו נע בין 1 ל-1,000 עם ערך של 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);
    }
  }
}

רוצה לנסות?

צריך להשתמש ב-APIs Explorer שבהמשך כדי לקרוא לשיטה הזו בנתונים בזמן אמת ולראות את התגובה. לחלופין, אפשר לנסות את ה-Explorer העצמאי.