REST Resource: spaces.messages.attachments
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Tài nguyên: Tệp đính kèm
Tệp đính kèm trong Google Chat.
Biểu diễn dưới dạng 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 .
} |
Trường |
name |
string
Không bắt buộc. Tên tài nguyên của tệp đính kèm, ở dạng spaces/{space}/messages/{message}/attachments/{attachment} .
|
contentName |
string
Chỉ có đầu ra. Tên tệp gốc của nội dung, chứ không phải đường dẫn đầy đủ.
|
contentType |
string
Chỉ có đầu ra. Loại nội dung (loại MIME) của tệp.
|
thumbnailUri |
string
Chỉ có đầu ra. URL hình thu nhỏ sẽ được dùng để xem trước tệp đính kèm cho người dùng. Ứng dụng nhắn tin không được sử dụng URL này để tải nội dung đính kèm xuống.
|
downloadUri |
string
Chỉ có đầu ra. URL tải xuống cần được dùng để cho phép người dùng tải tệp đính kèm xuống. Ứng dụng nhắn tin không được sử dụng URL này để tải nội dung đính kèm xuống.
|
source |
enum (Source )
Chỉ có đầu ra. Nguồn của tệp đính kèm.
|
Trường hợp hợp nhất data_ref . Tham chiếu dữ liệu đến tệp đính kèm. data_ref chỉ có thể là một trong những giá trị sau: |
attachmentDataRef |
object (AttachmentDataRef )
Không bắt buộc. Tham chiếu đến dữ liệu tệp đính kèm. Trường này dùng để tạo hoặc cập nhật tin nhắn có tệp đính kèm hoặc dùng API nội dung nghe nhìn để tải dữ liệu tệp đính kèm xuống.
|
driveDataRef |
object (DriveDataRef )
Chỉ có đầu ra. Tham chiếu đến tệp đính kèm trên Google Drive. Trường này được dùng với API Google Drive.
|
AttachmentDataRef
Tham chiếu đến dữ liệu tệp đính kèm.
Biểu diễn dưới dạng JSON |
{
"resourceName": string,
"attachmentUploadToken": string
} |
Trường |
resourceName |
string
Không bắt buộc. Tên tài nguyên của dữ liệu tệp đính kèm. Trường này được dùng với API nội dung nghe nhìn để tải dữ liệu tệp đính kèm xuống.
|
attachmentUploadToken |
string
Không bắt buộc. Mã thông báo mờ chứa tham chiếu đến tệp đính kèm đã tải lên. Được ứng dụng coi là một chuỗi mờ và dùng để tạo hoặc cập nhật tin nhắn Chat có tệp đính kèm.
|
Nguồn
Enum |
SOURCE_UNSPECIFIED |
Đã đặt trước. |
DRIVE_FILE |
Tệp là tệp trên Google Drive. |
UPLOADED_CONTENT |
Tệp sẽ được tải lên Chat. |
Phương thức |
|
Lấy siêu dữ liệu của tệp đính kèm trong thư. |
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
[null,null,["Cập nhật lần gần đây nhất: 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. |"]]