> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # UnassignRole # Package: memberManagement # Namespace: GroupRolesService # Method link: https://dev.wix.com/docs/api-reference/crm/community/groups/member-management/roles/unassign-role.md ## Introduction Unassigns a role from group members. You can only unassign `ADMIN` roles. Calling this method with group members with `role.value` set to `MEMBER` returns an error. > **Notes:** > + Only group admins can assign roles. > + You cannot remove members with this method. --- ## REST API ### Schema ``` Method: unassignRole Description: Unassigns a role from group members. You can only unassign `ADMIN` roles. Calling this method with group members with `role.value` set to `MEMBER` returns an error. > **Notes:** > + Only group admins can assign roles. > + You cannot remove members with this method. URL: https://www.wixapis.com/v2/groups/{groupId}/roles/unassign Method: POST Method parameters: param name: memberIds | type: array | description: Member GUIDs. Limited to 100 member GUIDs. See the Members API for details. param name: role | type: GroupRole | description: A group member may have multiple roles in a single group. Currently, only `MEMBER` and `ADMIN` roles are supported, but more roles may be available in the future. - name: value | type: Role | description: Member's role. - enum: - MEMBER: Regular group member. - ADMIN: Group administrator. Return type: UnassignRoleResponse - name: groupId | type: string | description: Group GUID. - name: memberIds | type: array | description: Member GUIDs. Limited to 100 member GUIDs. See the Members API for details. - name: role | type: GroupRole | description: Unassigned role. - name: value | type: Role | description: Member's role. - enum: - MEMBER: Regular group member. - ADMIN: Group administrator. ``` ### Examples ### UnassignRole ```curl ~~~cURL curl -X POST \ https://wixapis.com/social-groups/v2/groups/8a258cf5-49f3-41dc-b320-65ec2598315b/roles/unassign \ -H 'Content-Type: application/json;charset=UTF-8' \ -H 'Authorization: ' -d '{ "siteMemberIds": [ "e6674661-f294-4f1f-9f22-bc11fa8164e7" ], "role": { "value": "ADMIN" } }' ~~~ ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.memberManagement.GroupRolesService.unassignRole(groupId, memberIds, role) Description: Unassigns a role from group members. You can only unassign `ADMIN` roles. Calling this method with group members with `role.value` set to `MEMBER` returns an error. > **Notes:** > + Only group admins can assign roles. > + You cannot remove members with this method. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: groupId Method parameters: param name: groupId | type: string | description: Group GUID. | required: true param name: memberIds | type: array | description: Member GUIDs. Limited to 100 member GUIDs. See the Members API for details. param name: role | type: GroupRole | description: A group member may have multiple roles in a single group. Currently, only `MEMBER` and `ADMIN` roles are supported, but more roles may be available in the future. - name: value | type: Role | description: Member's role. - enum: - MEMBER: Regular group member. - ADMIN: Group administrator. Return type: PROMISE - name: groupId | type: string | description: Group GUID. - name: memberIds | type: array | description: Member GUIDs. Limited to 100 member GUIDs. See the Members API for details. - name: role | type: GroupRole | description: Unassigned role. - name: value | type: Role | description: Member's role. - enum: - MEMBER: Regular group member. - ADMIN: Group administrator. ``` ### Examples ### Unassign a role to a group member (with elevated permissions) ```javascript import { roles } from "@wix/groups"; import { auth } from "@wix/essentials"; // Sample ID values: // memberIds: ['7fe8e9e1-d050-4c86-9684-e7f231600a34'], // groupId: '0261a737-2361-4468-a3b1-5ec2b0667836.' // // Sample role value: // role: 'MEMBER' // const elevatedUnassignRole = auth.elevate(roles.unassignRole); export function unassignRole(groupId, memberIds, role) { return elevatedUnassignRole(groupId, memberIds, role) .then((response) => { console.log(response); }) .catch((error) => { console.error(error); }); } /* Promise resolves to: * role: "MEMBER" */ ``` ### Unassign a role to a group member ```javascript import { roles } from "@wix/groups"; // Sample ID values: // memberIds: ['7fe8e9e1-d050-4c86-9684-e7f231600a34'], // groupId: '0261a737-2361-4468-a3b1-5ec2b0667836.' // // Sample role value: // role: 'MEMBER' // export function unassignRole(groupId, memberIds, role) { return roles.unassignRole(groupId, memberIds, role) .then((response) => { console.log(response); }) .catch((error) => { console.error(error); }); } /* Promise resolves to: * role: "MEMBER" */ ``` ### unassignRole (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { roles } from '@wix/groups'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { roles }, // Include the auth strategy and host as relevant }); async function unassignRole(groupId,memberIds,role) { const response = await myWixClient.roles.unassignRole(groupId,memberIds,role); }; ``` ---