Method: spaces.create
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
स्पेस बनाता है. इसका इस्तेमाल, Import mode
में नाम वाला स्पेस या ग्रुप चैट बनाने के लिए किया जा सकता है. उदाहरण के लिए, स्पेस बनाना लेख पढ़ें.
इन तरह के authentication के साथ काम करता है:
ऐप्लिकेशन की पुष्टि के लिए, एडमिन की मंज़ूरी और अनुमति के लिए इनमें से कोई एक स्कोप:
https://www.googleapis.com/auth/chat.app.spaces.create
https://www.googleapis.com/auth/chat.app.spaces
उपयोगकर्ता की पुष्टि के लिए, अनुमति के इन स्कोप में से किसी एक का इस्तेमाल करें:
https://www.googleapis.com/auth/chat.spaces.create
https://www.googleapis.com/auth/chat.spaces
https://www.googleapis.com/auth/chat.import
(सिर्फ़ इंपोर्ट मोड वाले स्पेस)
ऐप्लिकेशन के तौर पर पुष्टि करते समय, अनुरोध में space.customer
फ़ील्ड सेट होना चाहिए.
ऐप्लिकेशन के तौर पर पुष्टि करते समय, Chat ऐप्लिकेशन को स्पेस के सदस्य के तौर पर जोड़ा जाता है. हालांकि, Chat ऐप्लिकेशन को स्पेस मैनेजर के तौर पर नहीं जोड़ा जाता है. डिफ़ॉल्ट रूप से, स्पेस के सभी सदस्य Chat ऐप्लिकेशन को स्पेस से हटा सकते हैं. अगर आपको सिर्फ़ स्पेस मैनेजर को किसी स्पेस से ऐप्लिकेशन हटाने की अनुमति देनी है, तो space.permission_settings.manage_apps
को managersAllowed
पर सेट करें.
स्पेस बनाते समय, स्पेस की सदस्यता इस बात पर निर्भर करती है कि स्पेस को Import mode
में बनाया गया है या नहीं:
- इंपोर्ट मोड: कोई सदस्य नहीं बनाया जाता.
- अन्य सभी मोड: कॉल करने वाले व्यक्ति को सदस्य के तौर पर जोड़ा जाता है. यह:
- ऐप्लिकेशन की पुष्टि करने की सुविधा का इस्तेमाल करते समय, ऐप्लिकेशन खुद.
- उपयोगकर्ता की पुष्टि करने की सुविधा का इस्तेमाल करने वाला व्यक्ति.
अगर स्पेस बनाते समय आपको गड़बड़ी का मैसेज ALREADY_EXISTS
मिलता है, तो कोई दूसरा displayName
आज़माएं. ऐसा हो सकता है कि Google Workspace संगठन के किसी मौजूदा स्पेस में पहले से ही इस डिसप्ले नेम का इस्तेमाल किया जा रहा हो.
एचटीटीपी अनुरोध
POST https://chat.googleapis.com/v1/spaces
यह यूआरएल, gRPC ट्रांसकोडिंग सिंटैक्स का इस्तेमाल करता है.
क्वेरी पैरामीटर
पैरामीटर |
requestId |
string
ज़रूरी नहीं. इस अनुरोध के लिए यूनीक आइडेंटिफ़ायर. हमारा सुझाव है कि आप रैंडम यूयूआईडी का इस्तेमाल करें. मौजूदा अनुरोध आईडी तय करने पर, नया स्पेस बनाने के बजाय, उस आईडी से बनाया गया स्पेस दिखता है. पुष्टि किए गए किसी दूसरे उपयोगकर्ता के साथ, उसी Chat ऐप्लिकेशन से मौजूदा अनुरोध आईडी तय करने पर गड़बड़ी होती है.
|
अनुरोध का मुख्य भाग
अनुरोध के मुख्य भाग में Space
का उदाहरण है.
जवाब का मुख्य भाग
अगर एपीआई सही से जुड़ जाता है, तो जवाब के मुख्य हिस्से में Space
का नया इंस्टेंस शामिल किया जाता है.
अनुमति के स्कोप
इसके लिए, इनमें से किसी एक OAuth स्कोप की ज़रूरत होती है:
https://www.googleapis.com/auth/chat.app.spaces.create
https://www.googleapis.com/auth/chat.app.spaces
https://www.googleapis.com/auth/chat.import
https://www.googleapis.com/auth/chat.spaces
https://www.googleapis.com/auth/chat.spaces.create
ज़्यादा जानकारी के लिए, अनुमति पाने से जुड़ी गाइड देखें.
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2025-07-29 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-07-29 (UTC) को अपडेट किया गया."],[[["\u003cp\u003eCreates a space in Google Chat, which can be a named space or a group chat, supporting app and user authentication.\u003c/p\u003e\n"],["\u003cp\u003eWhen using app authentication, the space.customer field is required and no members are added in Import mode; otherwise, the calling user becomes a member.\u003c/p\u003e\n"],["\u003cp\u003eUses the \u003ccode\u003ePOST https://chat.googleapis.com/v1/spaces\u003c/code\u003e HTTP request to create a space and requires specific OAuth scopes for authorization.\u003c/p\u003e\n"],["\u003cp\u003eThe request body should contain a Space object and the response, if successful, will contain the newly created Space object.\u003c/p\u003e\n"],["\u003cp\u003eIf the displayName already exists, an \u003ccode\u003eALREADY_EXISTS\u003c/code\u003e error will be returned, suggesting to try a different displayName.\u003c/p\u003e\n"]]],["This content outlines how to create a space using the Chat API. Key actions include sending a `POST` request to `https://chat.googleapis.com/v1/spaces`. The request may include a unique `requestId` and must contain a `Space` instance in the body. Authentication can be app-based or user-based, requiring specific OAuth scopes. Space membership varies by import mode; no members in import mode, otherwise the caller is added. Response will contain new space information.\n"],null,["# Method: spaces.create\n\n- [HTTP request](#body.HTTP_TEMPLATE)\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\nCreates a space. Can be used to create a named space, or a group chat in `Import mode`. For an example, see [Create a space](https://developers.google.com/workspace/chat/create-spaces).\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 [administrator approval](https://support.google.com/a?p=chat-app-auth) and one of the following authorization scopes:\n\n - `https://www.googleapis.com/auth/chat.app.spaces.create`\n - `https://www.googleapis.com/auth/chat.app.spaces`\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.spaces.create`\n - `https://www.googleapis.com/auth/chat.spaces`\n - `https://www.googleapis.com/auth/chat.import` (import mode spaces only)\n\nWhen authenticating as an app, the `space.customer` field must be set in the request.\n\nWhen authenticating as an app, the Chat app is added as a member of the space. However, unlike human authentication, the Chat app is not added as a space manager. By default, the Chat app can be removed from the space by all space members. To allow only space managers to remove the app from a space, set `space.permission_settings.manage_apps` to `managersAllowed`.\n\nSpace membership upon creation depends on whether the space is created in `Import mode`:\n\n- **Import mode:** No members are created.\n- **All other modes:** The calling user is added as a member. This is:\n - The app itself when using app authentication.\n - The human user when using user authentication.\n\nIf you receive the error message `ALREADY_EXISTS` when creating a space, try a different `displayName`. An existing space within the Google Workspace organization might already use this display name.\n\n### HTTP request\n\n`POST https://chat.googleapis.com/v1/spaces`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Query parameters\n\n| Parameters ||\n|-------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `requestId` | `string` Optional. A unique identifier for this request. A random UUID is recommended. Specifying an existing request ID returns the space created with that ID instead of creating a new space. Specifying an existing request ID from the same Chat app with a different authenticated user returns an error. |\n\n### Request body\n\nThe request body contains an instance of [Space](/workspace/chat/api/reference/rest/v1/spaces#Space).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [Space](/workspace/chat/api/reference/rest/v1/spaces#Space).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/chat.app.spaces.create`\n- `https://www.googleapis.com/auth/chat.app.spaces`\n- `https://www.googleapis.com/auth/chat.import`\n- `https://www.googleapis.com/auth/chat.spaces`\n- `https://www.googleapis.com/auth/chat.spaces.create`\n\nFor more information, see the [Authorization guide](/workspace/chat/authenticate-authorize)."]]