REST Resource: spaces.messages.attachments
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
리소스: Attachment
JSON 표현 |
{
"name": string,
"contentName": string,
"contentType": string,
"thumbnailUri": string,
"downloadUri": string,
"source": enum (Source ),
// Union field data_ref can be only one of the following:
"attachmentDataRef": {
object (AttachmentDataRef )
},
"driveDataRef": {
object (DriveDataRef )
}
// End of list of possible types for union field data_ref .
} |
필드 |
name |
string
선택사항입니다. spaces/{space}/messages/{message}/attachments/{attachment} 형식의 첨부파일 리소스 이름입니다.
|
contentName |
string
출력 전용입니다. 전체 경로가 아닌 콘텐츠의 원본 파일 이름입니다.
|
contentType |
string
출력 전용입니다. 파일의 콘텐츠 유형 (MIME 유형)입니다.
|
thumbnailUri |
string
출력 전용입니다. 사람 사용자에게 첨부파일을 미리 볼 때 사용해야 하는 썸네일 URL입니다. 채팅 앱은 이 URL을 사용하여 첨부파일 콘텐츠를 다운로드해서는 안 됩니다.
|
downloadUri |
string
출력 전용입니다. 사람이 첨부파일을 다운로드할 수 있도록 사용해야 하는 다운로드 URL입니다. 채팅 앱은 이 URL을 사용하여 첨부파일 콘텐츠를 다운로드해서는 안 됩니다.
|
source |
enum (Source )
출력 전용입니다. 첨부파일의 소스입니다.
|
통합 필드 data_ref . 첨부파일에 대한 데이터 참조입니다. data_ref 은 다음 중 하나여야 합니다. |
attachmentDataRef |
object (AttachmentDataRef )
선택사항입니다. 첨부파일 데이터 참조입니다. 이 필드는 첨부파일이 있는 메시지를 만들거나 업데이트하거나, media API를 사용하여 첨부파일 데이터를 다운로드하는 데 사용됩니다.
|
driveDataRef |
object (DriveDataRef )
출력 전용입니다. Google Drive 첨부파일에 대한 참조입니다. 이 필드는 Google Drive API와 함께 사용됩니다.
|
AttachmentDataRef
JSON 표현 |
{
"resourceName": string,
"attachmentUploadToken": string
} |
필드 |
resourceName |
string
선택사항입니다. 첨부파일 데이터의 리소스 이름입니다. 이 필드는 media API와 함께 사용하여 첨부파일 데이터를 다운로드하는 데 사용됩니다.
|
attachmentUploadToken |
string
선택사항입니다. 업로드된 첨부파일에 대한 참조가 포함된 불투명 토큰입니다. 클라이언트에서 불투명 문자열로 취급되며 첨부파일이 있는 Chat 메시지를 만들거나 업데이트하는 데 사용됩니다.
|
소스
열거형 |
SOURCE_UNSPECIFIED |
예약됨 |
DRIVE_FILE |
파일이 Google Drive 파일입니다. |
UPLOADED_CONTENT |
파일이 Chat에 업로드됩니다. |
메서드 |
|
메시지 첨부파일의 메타데이터를 가져옵니다. |
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-25(UTC)
[null,null,["최종 업데이트: 2025-07-25(UTC)"],[[["\u003cp\u003eAn \u003ccode\u003eAttachment\u003c/code\u003e resource represents a file attached to a Google Chat message, containing metadata such as file name, content type, and source.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eAttachment\u003c/code\u003e includes URLs for thumbnail preview and user download, but Chat apps should utilize the \u003ccode\u003edata_ref\u003c/code\u003e field for accessing content.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003edata_ref\u003c/code\u003e field can point to either uploaded content within Chat (\u003ccode\u003eAttachmentDataRef\u003c/code\u003e) or a Google Drive file (\u003ccode\u003eDriveDataRef\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eAttachmentDataRef\u003c/code\u003e is used by Chat apps to create/update messages with attachments or to download attachment data via the media API.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can use the \u003ccode\u003eget\u003c/code\u003e method to retrieve metadata for a specific message attachment.\u003c/p\u003e\n"]]],["Attachments in Google Chat contain metadata and data references. Key information includes the attachment's `name`, `contentName`, `contentType`, `thumbnailUri`, and `downloadUri`. The `source` indicates if it's from Google Drive or uploaded to Chat. `AttachmentDataRef` provides a `resourceName` for media API downloads and an `attachmentUploadToken` for creating/updating messages with attachments. Methods to retrieve attachments metadata are detailed. The data source can be either a Drive file or uploaded content.\n"],null,["# REST Resource: spaces.messages.attachments\n\n- [Resource: Attachment](#Attachment)\n - [JSON representation](#Attachment.SCHEMA_REPRESENTATION)\n - [AttachmentDataRef](#Attachment.AttachmentDataRef)\n - [JSON representation](#Attachment.AttachmentDataRef.SCHEMA_REPRESENTATION)\n - [Source](#Attachment.Source)\n- [Methods](#METHODS_SUMMARY)\n\nResource: Attachment\n--------------------\n\nAn attachment in Google Chat.\n\n| JSON representation |\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"name\": string, \"contentName\": string, \"contentType\": string, \"thumbnailUri\": string, \"downloadUri\": string, \"source\": enum (/workspace/chat/api/reference/rest/v1/spaces.messages.attachments#Attachment.Source), // Union field `data_ref` can be only one of the following: \"attachmentDataRef\": { object (/workspace/chat/api/reference/rest/v1/spaces.messages.attachments#Attachment.AttachmentDataRef) }, \"driveDataRef\": { object (/workspace/chat/api/reference/rest/v1/DriveDataRef) } // End of list of possible types for union field `data_ref`. } ``` |\n\n| Fields ||\n|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `name` | `string` Optional. Resource name of the attachment, in the form `spaces/{space}/messages/{message}/attachments/{attachment}`. |\n| `contentName` | `string` Output only. The original file name for the content, not the full path. |\n| `contentType` | `string` Output only. The content type (MIME type) of the file. |\n| `thumbnailUri` | `string` Output only. The thumbnail URL which should be used to preview the attachment to a human user. Chat apps shouldn't use this URL to download attachment content. |\n| `downloadUri` | `string` Output only. The download URL which should be used to allow a human user to download the attachment. Chat apps shouldn't use this URL to download attachment content. |\n| `source` | `enum (`[Source](/workspace/chat/api/reference/rest/v1/spaces.messages.attachments#Attachment.Source)`)` Output only. The source of the attachment. |\n| Union field `data_ref`. The data reference to the attachment. `data_ref` can be only one of the following: ||\n| `attachmentDataRef` | `object (`[AttachmentDataRef](/workspace/chat/api/reference/rest/v1/spaces.messages.attachments#Attachment.AttachmentDataRef)`)` Optional. A reference to the attachment data. This field is used to create or update messages with attachments, or with the media API to download the attachment data. |\n| `driveDataRef` | `object (`[DriveDataRef](/workspace/chat/api/reference/rest/v1/DriveDataRef)`)` Output only. A reference to the Google Drive attachment. This field is used with the Google Drive API. |\n\n### AttachmentDataRef\n\nA reference to the attachment data.\n\n| JSON representation |\n|---------------------------------------------------------------------|\n| ``` { \"resourceName\": string, \"attachmentUploadToken\": string } ``` |\n\n| Fields ||\n|-------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `resourceName` | `string` Optional. The resource name of the attachment data. This field is used with the media API to download the attachment data. |\n| `attachmentUploadToken` | `string` Optional. Opaque token containing a reference to an uploaded attachment. Treated by clients as an opaque string and used to create or update Chat messages with attachments. |\n\n### Source\n\nThe source of the attachment.\n\n| Enums ||\n|----------------------|----------------------------------|\n| `SOURCE_UNSPECIFIED` | Reserved. |\n| `DRIVE_FILE` | The file is a Google Drive file. |\n| `UPLOADED_CONTENT` | The file is uploaded to Chat. |\n\n| Methods ------- ||\n|----------------------------------------------------------------------------------|--------------------------------------------|\n| ### [get](/workspace/chat/api/reference/rest/v1/spaces.messages.attachments/get) | Gets the metadata of a message attachment. |"]]