Method: files.download
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
בקשת HTTP
POST https://www.googleapis.com/drive/v3/files/{fileId}/download
כתובת ה-URL משתמשת בתחביר של gRPC Transcoding.
פרמטרים של נתיב
פרמטרים |
fileId |
string
חובה. המזהה של הקובץ להורדה.
|
פרמטרים של שאילתה
פרמטרים |
mimeType |
string
אופציונלי. סוג ה-MIME של הקובץ שצריך להוריד. אפשר להגדיר את השדה הזה רק כשמורידים מסמכים של Google Workspace. רשימה של סוגי MIME נתמכים מופיעה במאמר ייצוא סוגי MIME למסמכי Google Workspace. אם לא מוגדר סוג MIME, מסמך Google Workspace יורד עם סוג MIME שמוגדר כברירת מחדל. סוג ה-MIME שמוגדר כברירת מחדל עשוי להשתנות בעתיד.
|
revisionId |
string
אופציונלי. מזהה הגרסה של הקובץ להורדה. אפשר להגדיר את השדה הזה רק כשמורידים קובצי Blob, מסמכי Google וגיליונות אלקטרוניים של Google. הפונקציה מחזירה INVALID_ARGUMENT אם הורדה של גרסה ספציפית של הקובץ לא נתמכת.
|
גוף הבקשה
גוף הבקשה צריך להיות ריק.
גוף התשובה
אם הפעולה בוצעה ללא שגיאות, גוף התגובה יכיל מופע של Operation
.
היקפי הרשאה
נדרש אחד מהיקפי ההרשאות הבאים של OAuth:
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/drive.readonly
יש היקפי הרשאות מוגבלים שנדרשת הערכת אבטחה כדי להשתמש בהם באפליקציה. מידע נוסף זמין במדריך ההרשאות.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-08-27 (שעון UTC).
[null,null,["עדכון אחרון: 2025-08-27 (שעון UTC)."],[],[],null,["# Method: files.download\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nDownloads content of a file. Operations are valid for 24 hours from the time of creation.\n\n### HTTP request\n\n`POST https://www.googleapis.com/drive/v3/files/{fileId}/download`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|----------------------------------------------------|\n| `fileId` | `string` Required. The ID of the file to download. |\n\n### Query parameters\n\n| Parameters ||\n|--------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `mimeType` | `string` Optional. The MIME type the file should be downloaded as. This field can only be set when downloading Google Workspace documents. See [files.export MIME types for Google Workspace documents](/drive/api/guides/ref-export-formats) for the list of supported MIME types. If not set, a Google Workspace document is downloaded with a default MIME type. The default MIME type might change in the future. |\n| `revisionId` | `string` Optional. The revision ID of the file to download. This field can only be set when downloading blob files, Google Docs, and Google Sheets. Returns `INVALID_ARGUMENT` if downloading a specific revision on the file is unsupported. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nIf successful, the response body contains an instance of [Operation](/workspace/drive/api/reference/rest/v3/operations#Operation).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/drive`\n- `\n https://www.googleapis.com/auth/drive.file`\n- `\n https://www.googleapis.com/auth/drive.readonly`\n\nSome scopes are restricted and require a security assessment for your app to use them. For more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]