ดาวน์โหลดสื่อที่อัปโหลด ไม่ใช่ไฟล์ Google ไดรฟ์ รองรับการดาวน์โหลดใน URI /v1/media/{+name}?alt=media หากต้องการส่งออกไบต์จากไฟล์ Google ไดรฟ์ ให้ดูเมธอด files.export ใน Google ไดรฟ์
คำขอ HTTP
GET https://chat.googleapis.com/v1/media/{resourceName=**}
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-07-25 UTC"],[[["\u003cp\u003eDownloads uploaded media, excluding Google Drive files, using the \u003ccode\u003e/v1/media/{+name}?alt=media\u003c/code\u003e URI.\u003c/p\u003e\n"],["\u003cp\u003eTo download, use a GET request specifying the media's resource name in the URL path.\u003c/p\u003e\n"],["\u003cp\u003eThe response provides the file content as bytes, supporting partial downloads via the \u003ccode\u003eRange\u003c/code\u003e header.\u003c/p\u003e\n"],["\u003cp\u003eAuthorization requires a Chat scope like \u003ccode\u003echat.bot\u003c/code\u003e, \u003ccode\u003echat.messages\u003c/code\u003e, or \u003ccode\u003echat.messages.readonly\u003c/code\u003e.\u003c/p\u003e\n"]]],["The core functionality involves downloading uploaded media via a `GET` HTTP request to `/v1/media/{resourceName}`. The `resourceName` path parameter specifies the media to download. The request body must be empty. A successful response returns the file content as bytes. Partial downloads are supported using the `Range` header. Access requires specific OAuth scopes: `chat.bot`, `chat.messages`, or `chat.messages.readonly`. Google Drive files utilize a separate files.export method.\n"],null,["# Method: media.download\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n - [JSON representation](#body.Media.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n\nDownloads uploaded media, but not Google Drive files. Download is supported on the URI `/v1/media/{+name}?alt=media`. To export bytes from a Google Drive file, see the [files.export](https://developers.google.com/drive/api/reference/rest/v3/files/export) method in Google Drive.\n\n### HTTP request\n\n`GET https://chat.googleapis.com/v1/media/{resourceName=**}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `resourceName` | `string` Name of the media that you are downloading. For more information, see [spaces.messages.attachments.attachmentDataRef](https://developers.google.com/workspace/chat/api/reference/rest/v1/spaces.messages.attachments#Attachment.AttachmentDataRef). |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nIf successful, this method returns the file content as bytes.\n\nTo download only part of a file, use the `Range` header with a [byte range](https://www.rfc-editor.org/rfc/rfc9110.html#name-byte-ranges). For example: `Range: bytes=500-999`.\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/chat.bot`\n- `https://www.googleapis.com/auth/chat.messages`\n- `https://www.googleapis.com/auth/chat.messages.readonly`\n\nFor more information, see the [Authorization guide](/workspace/chat/authenticate-authorize)."]]