Method: spaces.messages.patch
อัปเดตข้อความ วิธีการ patch
และ update
แตกต่างกัน เมธอด patch
ใช้คําขอ patch
ส่วนเมธอด update
ใช้คําขอ put
เราขอแนะนำให้ใช้วิธีการ patch
ดูตัวอย่างได้ที่อัปเดตข้อความ
รองรับการตรวจสอบสิทธิ์ประเภทต่อไปนี้
เมื่อใช้การตรวจสอบสิทธิ์ของแอป คำขอจะอัปเดตได้เฉพาะข้อความที่สร้างโดยแอป Chat ที่โทรเข้ามาเท่านั้น
คำขอ HTTP
PATCH 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 และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-02-27 UTC
[null,null,["อัปเดตล่าสุด 2025-02-27 UTC"],[[["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`)."]]],["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"]]