Method: files.download
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ดาวน์โหลดเนื้อหาของไฟล์ ดูข้อมูลเพิ่มเติมได้ที่ดาวน์โหลดและส่งออกไฟล์
การดำเนินการจะมีอายุ 24 ชั่วโมงนับจากเวลาที่สร้าง
คำขอ HTTP
POST https://www.googleapis.com/drive/v3/files/{fileId}/download
URL ใช้ไวยากรณ์การแปลงรหัส gRPC
พารามิเตอร์เส้นทาง
พารามิเตอร์ |
fileId |
string
ต้องระบุ รหัสของไฟล์ที่จะดาวน์โหลด
|
พารามิเตอร์การค้นหา
พารามิเตอร์ |
mimeType |
string
ไม่บังคับ ประเภท MIME ที่ควรใช้ในการดาวน์โหลดไฟล์ ตั้งค่าฟิลด์นี้ได้เมื่อดาวน์โหลดเอกสาร Google Workspace เท่านั้น ดูรายการประเภท MIME ที่รองรับได้ที่ส่งออกประเภท MIME สำหรับเอกสาร Google Workspace หากไม่ได้ตั้งค่า ระบบจะดาวน์โหลดเอกสาร 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
ขอบเขตบางอย่างถูกจำกัดและต้องมีการประเมินความปลอดภัยเพื่อให้แอปของคุณใช้ขอบเขตเหล่านั้นได้ ดูข้อมูลเพิ่มเติมได้ที่คู่มือการให้สิทธิ์
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 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)."]]