Method: spaces.messages.patch
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
मैसेज अपडेट करता है. patch
और update
के तरीकों में अंतर है. patch
तरीके में patch
अनुरोध का इस्तेमाल किया जाता है, जबकि update
तरीके में put
अनुरोध का इस्तेमाल किया जाता है. हमारा सुझाव है कि आप patch
तरीके का इस्तेमाल करें. उदाहरण के लिए, मैसेज अपडेट करना लेख पढ़ें.
इन तरह के authentication के साथ काम करता है:
अनुमति के दायरे के साथ ऐप्लिकेशन की पुष्टि करना:
https://www.googleapis.com/auth/chat.bot
उपयोगकर्ता की पुष्टि के लिए, अनुमति के इन स्कोप में से किसी एक का इस्तेमाल करें:
https://www.googleapis.com/auth/chat.messages
https://www.googleapis.com/auth/chat.import
(सिर्फ़ इंपोर्ट मोड वाले स्पेस)
ऐप्लिकेशन की पुष्टि करने की सुविधा का इस्तेमाल करते समय, अनुरोध सिर्फ़ उस Chat ऐप्लिकेशन से बनाए गए मैसेज को अपडेट कर सकते हैं जिससे कॉल किया जा रहा है.
एचटीटीपी अनुरोध
PATCH https://chat.googleapis.com/v1/{message.name=spaces/*/messages/*}
यह यूआरएल, 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
ज़्यादा जानकारी के लिए, अनुमति देने से जुड़ी गाइड देखें.
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-08-20 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-08-20 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eUpdates a Google Chat message using the \u003ccode\u003ePATCH\u003c/code\u003e method, preferably over the \u003ccode\u003eupdate\u003c/code\u003e method which uses \u003ccode\u003ePUT\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eSupports both app and user authentication, with app authentication limited to updating messages created by the calling Chat app.\u003c/p\u003e\n"],["\u003cp\u003eRequires specifying the message to update using its resource name in the URL path and the fields to update using the \u003ccode\u003eupdateMask\u003c/code\u003e query parameter.\u003c/p\u003e\n"],["\u003cp\u003eAllows creation of a new message if the original is not found when \u003ccode\u003eallowMissing\u003c/code\u003e query parameter is set to \u003ccode\u003etrue\u003c/code\u003e and a client-assigned message ID is provided.\u003c/p\u003e\n"],["\u003cp\u003eRequires authorization with one of the specified OAuth scopes (\u003ccode\u003echat.bot\u003c/code\u003e, \u003ccode\u003echat.import\u003c/code\u003e, or \u003ccode\u003echat.messages\u003c/code\u003e).\u003c/p\u003e\n"]]],["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"],null,["# Method: spaces.messages.patch\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nUpdates a message. There's a difference between the `patch` and `update` methods. The `patch` method uses a `patch` request while the `update` method uses a `put` request. We recommend using the `patch` method. For an example, see [Update a message](https://developers.google.com/workspace/chat/update-messages).\n\nSupports the following types of [authentication](https://developers.google.com/workspace/chat/authenticate-authorize):\n\n- [App authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-app) with the authorization scope:\n\n - `https://www.googleapis.com/auth/chat.bot`\n- [User authentication](https://developers.google.com/workspace/chat/authenticate-authorize-chat-user) with one of the following authorization scopes:\n\n - `https://www.googleapis.com/auth/chat.messages`\n - `https://www.googleapis.com/auth/chat.import` (import mode spaces only)\n\nWhen using app authentication, requests can only update messages created by the calling Chat app.\n\n### HTTP request\n\n`PATCH https://chat.googleapis.com/v1/{message.name=spaces/*/messages/*}`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `message.name` | `string` Identifier. Resource name of the message. Format: `spaces/{space}/messages/{message}` Where `{space}` is the ID of the space where the message is posted and `{message}` is a system-assigned ID for the message. For example, `spaces/AAAAAAAAAAA/messages/BBBBBBBBBBB.BBBBBBBBBBB`. If you set a custom ID when you create a message, you can use this ID to specify the message in a request by replacing `{message}` with the value from the `clientAssignedMessageId` field. For example, `spaces/AAAAAAAAAAA/messages/client-custom-name`. For details, see [Name a message](https://developers.google.com/workspace/chat/create-messages#name_a_created_message). |\n\n### Query parameters\n\n| Parameters ||\n|----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `updateMask` | `string (`[FieldMask](https://protobuf.dev/reference/protobuf/google.protobuf/#field-mask)` format)` Required. The field paths to update. Separate multiple values with commas or use `*` to update all field paths. Currently supported field paths: - `text` - `attachment` - `cards` (Requires [app authentication](/chat/api/guides/auth/service-accounts).) - `cardsV2` (Requires [app authentication](/chat/api/guides/auth/service-accounts).) - `accessoryWidgets` (Requires [app authentication](/chat/api/guides/auth/service-accounts).) - `quotedMessageMetadata` (Only allows removal of the quoted message.) |\n| `allowMissing` | `boolean` Optional. If `true` and the message isn't found, a new message is created and `updateMask` is ignored. The specified message ID must be [client-assigned](https://developers.google.com/workspace/chat/create-messages#name_a_created_message) or the request fails. |\n\n### Request body\n\nThe request body contains an instance of [Message](/workspace/chat/api/reference/rest/v1/spaces.messages#Message).\n\n### Response body\n\nIf successful, the response body contains an instance of [Message](/workspace/chat/api/reference/rest/v1/spaces.messages#Message).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/chat.bot`\n- `https://www.googleapis.com/auth/chat.import`\n- `https://www.googleapis.com/auth/chat.messages`\n\nFor more information, see the [Authorization guide](/workspace/chat/authenticate-authorize)."]]