Method: spaces.messages.patch
更新訊息。patch
和 update
方法有差異。patch
方法會使用 patch
要求,update
方法則使用 put
要求。建議您使用 patch
方法。如需範例,請參閱「更新訊息」。
支援以下類型的驗證:
使用應用程式驗證時,要求只能更新由呼叫的 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,就可以使用這個 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 和/或其關聯企業的註冊商標。
上次更新時間:2024-11-04 (世界標準時間)。
[null,null,["上次更新時間:2024-11-04 (世界標準時間)。"],[[["Updates a Google Chat message using the `PATCH` method, preferably over the `update` method which uses `PUT`."],["Supports both app and user authentication, with app authentication limited to updating messages created by the calling Chat app."],["Requires specifying the message to update using its resource name in the URL path and the fields to update using the `updateMask` query parameter."],["Allows creation of a new message if the original is not found when `allowMissing` query parameter is set to `true` and a client-assigned message ID is provided."],["Requires authorization with one of the specified OAuth scopes (`chat.bot`, `chat.import`, or `chat.messages`)."]]],[]]