Method: spaces.members.create
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
यह Chat ऐप्लिकेशन, किसी उपयोगकर्ता या Google ग्रुप के लिए सदस्यता बनाता है. Chat के अन्य ऐप्लिकेशन के लिए सदस्यताएं नहीं बनाई जा सकतीं. सदस्यता बनाते समय, अगर चुने गए सदस्य ने न्योते अपने-आप स्वीकार करने की नीति बंद की हुई है, तो उसे न्योता भेजा जाता है. उसे स्पेस में शामिल होने से पहले, न्योता स्वीकार करना होगा. इसके अलावा, सदस्यता बनाने पर सदस्य को सीधे तौर पर चुने गए स्पेस में जोड़ दिया जाता है.
इन तरह के authentication के साथ काम करता है:
एडमिन की मंज़ूरी और अनुमति के दायरे के साथ ऐप्लिकेशन की पुष्टि करना:
https://www.googleapis.com/auth/chat.app.memberships
उपयोगकर्ता की पुष्टि के लिए, अनुमति के इन स्कोप में से किसी एक का इस्तेमाल करें:
https://www.googleapis.com/auth/chat.memberships
https://www.googleapis.com/auth/chat.memberships.app
(स्पेस में कॉल करने वाला ऐप्लिकेशन जोड़ने के लिए)
https://www.googleapis.com/auth/chat.import
(सिर्फ़ इंपोर्ट मोड वाले स्पेस)
- उपयोगकर्ता की पुष्टि करने पर, एडमिन के अधिकारों को अनुमति मिलती है. ऐसा तब होता है, जब एडमिन खाता पुष्टि करता है,
useAdminAccess
true
होता है, और अनुमति के इस स्कोप का इस्तेमाल किया जाता है:
https://www.googleapis.com/auth/chat.admin.memberships
ऐप्लिकेशन की मदद से पुष्टि करने की सुविधा, इन इस्तेमाल के उदाहरणों के लिए काम नहीं करती:
- Workspace का इस्तेमाल करने वाले उस संगठन से बाहर के लोगों को न्योता भेजना जिसके पास स्पेस का मालिकाना हक है.
- किसी स्पेस में Google ग्रुप जोड़ना.
- किसी स्पेस में Chat ऐप्लिकेशन जोड़ना.
इस्तेमाल से जुड़े उदाहरण के लिए, यह लेख पढ़ें:
एचटीटीपी अनुरोध
POST https://chat.googleapis.com/v1/{parent=spaces/*}/members
यह यूआरएल, gRPC ट्रांसकोडिंग सिंटैक्स का इस्तेमाल करता है.
पाथ पैरामीटर
पैरामीटर |
parent |
string
ज़रूरी है. उस स्पेस के संसाधन का नाम जिसके लिए सदस्यता बनानी है. फ़ॉर्मैट: spaces/{space}
|
क्वेरी पैरामीटर
पैरामीटर |
useAdminAccess |
boolean
ज़रूरी नहीं. true होने पर, यह तरीका उपयोगकर्ता के Google Workspace एडमिन के अधिकारों का इस्तेमाल करके काम करता है. कॉल करने वाला व्यक्ति, Google Workspace एडमिन होना चाहिए. साथ ही, उसके पास चैट और स्पेस में होने वाली बातचीत को मैनेज करने का अधिकार होना चाहिए. इसके लिए, chat.admin.memberships OAuth 2.0 स्कोप की ज़रूरत होती है. एडमिन ऐक्सेस का इस्तेमाल करके, ऐप्लिकेशन की सदस्यताएं नहीं बनाई जा सकतीं. इसके अलावा, एडमिन के Google Workspace संगठन से बाहर के उपयोगकर्ताओं के लिए सदस्यताएं भी नहीं बनाई जा सकतीं.
|
अनुरोध का मुख्य भाग
अनुरोध के मुख्य भाग में Membership
का उदाहरण है.
जवाब का मुख्य भाग
अगर एपीआई सही से जुड़ जाता है, तो जवाब के मुख्य हिस्से में Membership
का नया इंस्टेंस शामिल किया जाता है.
अनुमति के स्कोप
इसके लिए, इनमें से किसी एक OAuth स्कोप की ज़रूरत होती है:
https://www.googleapis.com/auth/chat.app.memberships
https://www.googleapis.com/auth/chat.admin.memberships
https://www.googleapis.com/auth/chat.import
https://www.googleapis.com/auth/chat.memberships
https://www.googleapis.com/auth/chat.memberships.app
ज़्यादा जानकारी के लिए, अनुमति पाने से जुड़ी गाइड देखें.
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को 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 memberships for the calling Chat app, a user, or a Google Group in a specified space.\u003c/p\u003e\n"],["\u003cp\u003eSupports app authentication (with admin approval in Developer Preview) and user authentication (with optional admin access).\u003c/p\u003e\n"],["\u003cp\u003eTo use administrator privileges, set the \u003ccode\u003euseAdminAccess\u003c/code\u003e query parameter to \u003ccode\u003etrue\u003c/code\u003e and ensure the user has the required permissions and scope.\u003c/p\u003e\n"],["\u003cp\u003eRequires specific OAuth scopes for authorization, such as \u003ccode\u003echat.app.memberships\u003c/code\u003e or \u003ccode\u003echat.admin.memberships\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eIf the member has auto-accept turned off, an invitation is sent; otherwise, they are directly added to the space.\u003c/p\u003e\n"]]],["This describes how to create a membership in Google Chat spaces using a `POST` request to `https://chat.googleapis.com/v1/{parent=spaces/*}/members`. Memberships can be created for a Chat app, user, or Google Group. Authentication supports app or user access, with optional administrator privileges via the `useAdminAccess` query parameter. The request includes path and query parameters and a `Membership` object in the body; the response returns the newly created `Membership`. Authorization requires specific OAuth scopes.\n"],null,["# Method: spaces.members.create\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\nCreates a membership for the calling Chat app, a user, or a Google Group. Creating memberships for other Chat apps isn't supported. When creating a membership, if the specified member has their auto-accept policy turned off, then they're invited, and must accept the space invitation before joining. Otherwise, creating a membership adds the member directly to the specified space.\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 the authorization scope:\n\n - `https://www.googleapis.com/auth/chat.app.memberships`\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.memberships`\n - `https://www.googleapis.com/auth/chat.memberships.app` (to add the calling app to the space)\n - `https://www.googleapis.com/auth/chat.import` (import mode spaces only)\n - User authentication grants administrator privileges when an administrator account authenticates, `useAdminAccess` is `true`, and the following authorization scope is used:\n - `https://www.googleapis.com/auth/chat.admin.memberships`\n\nApp authentication is not supported for the following use cases:\n\n- Inviting users external to the Workspace organization that owns the space.\n- Adding a Google Group to a space.\n- Adding a Chat app to a space.\n\nFor example usage, see:\n\n- [Invite or add a user to a space](https://developers.google.com/workspace/chat/create-members#create-user-membership).\n- [Invite or add a Google Group to a space](https://developers.google.com/workspace/chat/create-members#create-group-membership).\n- [Add the Chat app to a space](https://developers.google.com/workspace/chat/create-members#create-membership-calling-api).\n\n### HTTP request\n\n`POST https://chat.googleapis.com/v1/{parent=spaces/*}/members`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|--------------------------------------------------------------------------------------------------------------|\n| `parent` | `string` Required. The resource name of the space for which to create the membership. Format: spaces/{space} |\n\n### Query parameters\n\n| Parameters ||\n|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `useAdminAccess` | `boolean` Optional. When `true`, the method runs using the user's Google Workspace administrator privileges. The calling user must be a Google Workspace administrator with the [manage chat and spaces conversations privilege](https://support.google.com/a/answer/13369245). Requires the `chat.admin.memberships` [OAuth 2.0 scope](https://developers.google.com/workspace/chat/authenticate-authorize#chat-api-scopes). Creating app memberships or creating memberships for users outside the administrator's Google Workspace organization isn't supported using admin access. |\n\n### Request body\n\nThe request body contains an instance of [Membership](/workspace/chat/api/reference/rest/v1/spaces.members#Membership).\n\n### Response body\n\nIf successful, the response body contains a newly created instance of [Membership](/workspace/chat/api/reference/rest/v1/spaces.members#Membership).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/chat.app.memberships`\n- `https://www.googleapis.com/auth/chat.admin.memberships`\n- `https://www.googleapis.com/auth/chat.import`\n- `https://www.googleapis.com/auth/chat.memberships`\n- `https://www.googleapis.com/auth/chat.memberships.app`\n\nFor more information, see the [Authorization guide](/workspace/chat/authenticate-authorize)."]]