Method: spaces.messages.update
อัปเดตข้อความ วิธีการ patch
และ update
แตกต่างกัน เมธอด patch
ใช้คําขอ patch
ส่วนเมธอด update
ใช้คําขอ put
เราขอแนะนำให้ใช้เมธอด patch
ดูตัวอย่างได้ที่อัปเดตข้อความ
รองรับการตรวจสอบสิทธิ์ประเภทต่อไปนี้
เมื่อใช้การตรวจสอบสิทธิ์ของแอป คำขอจะอัปเดตได้เฉพาะข้อความที่สร้างโดยแอป Chat ที่โทรเข้ามาเท่านั้น
คำขอ HTTP
PUT https://chat.googleapis.com/v1/{message.name=spaces/*/messages/*}
URL ใช้ไวยากรณ์การแปลง gRPC
พารามิเตอร์เส้นทาง
พารามิเตอร์ |
message.name |
string
ตัวระบุ ชื่อทรัพยากรของข้อความ รูปแบบ: spaces/{space}/messages/{message} โดยที่ {space} คือรหัสของพื้นที่ทำงานที่มีการโพสต์ข้อความ และ {message} คือรหัสที่ระบบกำหนดให้สำหรับข้อความ เช่น spaces/AAAAAAAAAAA/messages/BBBBBBBBBBB.BBBBBBBBBBB หากตั้งค่ารหัสที่กำหนดเองเมื่อสร้างข้อความ คุณจะใช้รหัสนี้เพื่อระบุข้อความในคำขอได้โดยแทนที่ {message} ด้วยค่าจากช่อง clientAssignedMessageId เช่น spaces/AAAAAAAAAAA/messages/client-custom-name โปรดดูรายละเอียดที่หัวข้อตั้งชื่อข้อความ
|
พารามิเตอร์การค้นหา
พารามิเตอร์ |
updateMask |
string (FieldMask format)
ต้องระบุ เส้นทางฟิลด์ที่จะอัปเดต คั่นค่าหลายค่าด้วยเครื่องหมายจุลภาคหรือใช้ * เพื่ออัปเดตเส้นทางช่องทั้งหมด เส้นทางฟิลด์ที่รองรับในปัจจุบัน
|
allowMissing |
boolean
ไม่บังคับ หากไม่พบ true และข้อความ ระบบจะสร้างข้อความใหม่และละเว้น updateMask รหัสข้อความที่ระบุต้องกำหนดโดยไคลเอ็นต์ มิฉะนั้นคำขอจะไม่สำเร็จ
|
เนื้อหาของคำขอ
เนื้อความของคำขอมีอินสแตนซ์ของ Message
เนื้อหาการตอบกลับ
หากทำสำเร็จ เนื้อหาการตอบกลับจะมีอินสแตนซ์ Message
ขอบเขตการให้สิทธิ์
ต้องใช้ขอบเขต OAuth รายการใดรายการหนึ่งต่อไปนี้
https://www.googleapis.com/auth/chat.bot
https://www.googleapis.com/auth/chat.import
https://www.googleapis.com/auth/chat.messages
สำหรับข้อมูลเพิ่มเติม โปรดดูที่คู่มือการให้สิทธิ์
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2024-11-04 UTC
[null,null,["อัปเดตล่าสุด 2024-11-04 UTC"],[[["Updates a Google Chat message using the `PUT` method, preferably with the `patch` approach for partial modifications."],["Requires providing the message's resource name in the URL path for identification."],["Allows specifying fields to update using `updateMask` and supports creating a new message if the original is missing with `allowMissing` set to `true`."],["Authentication can be done using app authentication or user authentication, with app authentication restricting updates to messages created by the calling Chat app."],["Needs authorization with specific OAuth scopes like `chat.bot`, `chat.import`, or `chat.messages`."]]],["This describes updating messages in Google Chat using either `patch` or `put` requests, recommending `patch`. The `PUT` request uses the format `https://chat.googleapis.com/v1/{message.name=spaces/*/messages/*}`. Updating requires specifying the `message.name` path parameter and the `updateMask` query parameter to identify fields to modify. Optional `allowMissing` creates a new message if one is not found. The request and response body are `Message` instances. Authorization requires specific OAuth scopes. App authentication can update messages from the calling app only.\n"]]