You can update a list of users belonging to a group with the updateGroupMembers method.
Permissions to run the request: Account Owner, Administrators, Department Administrators or users with a role with custom settings allowing them to replace group users.
|credentials (required)||credentials||Read the description of the Credentials object.|
The ID of the group whose users will be replaced.
The name of the group.
The ID of the users who will be added to the group.
The users whose IDs are indicated in the method will completely replace existing group members. That means that an empty userIds parameter sent within the method will remove all users from the group. If two user IDs are sent, all previous groups members will be deleted from the group and two new participants will be added.
Let's say, a Department Administrator or a user with a role with custom settings allowing them to replace group users sends a list of new users which should be added to the group. There are already some users in the group, both from departments the sender manages and from departments the sender doesn't have access to.
After the method is performed, all new users sent within the method will be added to the group. But concerning existing members, only users from the departments the sender manages and their daughter departments will be removed.
Participants who belong to the departments which aren't managed by the sender will remain in the group.
After the request has been completed, the system returns an object with the following properties
|success||bool||True if users have been successfully replaced.|
|Permission denied||The user has no permissions to replace users in the group|
|Wrong Parameters||The system failed to process the request because it did not contain all necessary parameters|