Skip to main content

setMembersTo

GroupWrapper setMembersTo(id, MembersRequest)

POST /api/2.0/group/{id}/members

Replace group members

Replaces the whole member list of a group with the accounts given in the request, removing everybody who is not in that list. The caller needs the permissions to edit groups and to add and remove users, and the ID has to belong to a group that has not been deleted, otherwise the operation answers 404. At least one of the listed accounts has to be usable as a group member, otherwise the call is rejected with 400 and the group is left untouched; the accounts that cannot be members - a guest, a disabled account or an ID that matches nobody - are then silently skipped while the rest are applied. The replacement is not atomic: the current members are removed first and the new ones added afterwards, so a failure in between can leave the group empty. The answer is the group with the members it ends up with, which is why it should be read instead of assuming the request was applied verbatim. To add or remove a few accounts without touching the others, use PUT api/2.0/group/{id}/members and DELETE api/2.0/group/{id}/members.

Parameters​

NameInTypeDescriptionNotes
idpathUUID (uuid)The ID of the group whose members are changed, taken from the route. It has to be a group that has not been deleted, otherwise the operation answers 404.[required] [example: 00000000-0000-0000-0000-000000000000]
MembersRequestbodyMembersRequestThe accounts to add, replace with, or remove.[required]

Responses​

Status codeDescriptionTypeResponse headers
200The group with the members it ends up withGroupWrapperX-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset
400The request body cannot be read or has no members list, or none of the listed accounts can be a group member--
403No permissions to perform this action--
404No group has the specified ID--
401UnauthorizedErrorApiResponse-
429Too Many Requests.ErrorApiResponseRetry-After
500Internal Server Error.ErrorApiResponse-
502Bad Gateway. Returned by the reverse proxy, response body may be HTML and not JSON.--
503Service Unavailable. Returned by the reverse proxy, response body may be HTML and not JSON.--

Return type​

GroupWrapper

Authorization​

Basic, OAuth2 (scopes: read, write), ApiKeyBearer, asc_auth_key, Bearer, OpenId

HTTP request headers​

  • Content-Type: application/json
  • Accept: application/json