Method: files.download
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
HTTP リクエスト
POST https://www.googleapis.com/drive/v3/files/{fileId}/download
この URL は gRPC Transcoding 構文を使用します。
パスパラメータ
パラメータ |
fileId |
string
必須。ダウンロードするファイルの ID。
|
クエリ パラメータ
パラメータ |
mimeType |
string
省略可。ファイルのダウンロード時の MIME タイプ。このフィールドは、Google Workspace ドキュメントをダウンロードするときにのみ設定できます。サポートされている MIME タイプのリストについては、Google Workspace ドキュメントのエクスポート MIME タイプをご覧ください。設定されていない場合、Google Workspace ドキュメントはデフォルトの MIME タイプでダウンロードされます。デフォルトの MIME タイプは今後変更される可能性があります。
|
revisionId |
string
省略可。ダウンロードするファイルのリビジョン ID。このフィールドは、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)."]]