Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
Method: spaces.messages.patch
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
更新訊息。patch 和 update 方法有所不同。patch 方法會使用 patch 要求,而 update 方法則會使用 put 要求。建議使用 patch 方法。如需範例,請參閱「更新訊息」。
支援下列類型的驗證:
應用程式驗證 (授權範圍):
https://www.googleapis.com/auth/chat.bot
使用者驗證,並使用下列其中一個授權範圍:
https://www.googleapis.com/auth/chat.messages
https://www.googleapis.com/auth/chat.import (僅限匯入模式聊天室)
使用應用程式驗證時,要求只能更新呼叫 Chat 應用程式建立的訊息。
HTTP 要求
PATCH https://chat.googleapis.com/v1/{message.name=spaces/*/messages/*}
這個網址使用 gRPC 轉碼語法。
路徑參數
| 參數 |
message.name |
string
ID。訊息的資源名稱。 格式:spaces/{space}/messages/{message} 其中 {space} 是訊息張貼所在聊天室的 ID,{message} 則是系統指派的訊息 ID。例如:spaces/AAAAAAAAAAA/messages/BBBBBBBBBBB.BBBBBBBBBBB。 如果您在建立訊息時設定自訂 ID,即可在要求中指定訊息,方法是將 {message} 替換為 clientAssignedMessageId 欄位的值。例如 spaces/AAAAAAAAAAA/messages/client-custom-name。詳情請參閱「為訊息命名」。
|
查詢參數
| 參數 |
updateMask |
string (FieldMask format)
必要欄位。要更新的欄位路徑。以半形逗號分隔多個值,或使用 * 更新所有欄位路徑。 目前支援的欄位路徑:
|
allowMissing |
boolean
(選用步驟) 如果找不到 true 和訊息,系統會建立新訊息並忽略 updateMask。指定的訊息 ID 必須是用戶端指派,否則要求會失敗。
|
回應主體
如果成功,回應主體會包含 Message 的執行例項。
授權範圍
需要下列其中一種 OAuth 範圍:
https://www.googleapis.com/auth/chat.bot
https://www.googleapis.com/auth/chat.import
https://www.googleapis.com/auth/chat.messages
詳情請參閱授權指南。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-20 (世界標準時間)。
[null,null,["上次更新時間:2025-08-20 (世界標準時間)。"],[],["This documentation outlines how to update a message using the `PATCH` method via an HTTP request to `https://chat.googleapis.com/v1/{message.name=spaces/*/messages/*}`. The `message.name` path parameter is required, specifying the message's resource name. The `updateMask` query parameter is mandatory, indicating which fields to update (e.g., text, attachments). Optionally, `allowMissing` creates a new message if one isn't found. The request and response bodies utilize the `Message` resource, and app or user authentication are supported, with specific authentication impacting permissions.\n"]]