Method: media.download
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-25(UTC)
[null,null,["최종 업데이트: 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)."]]