Edit group
Request description
Endpoint: /users/groups/:id/update
Method: PATCH
The following parameter must be passed through the URL:
id: specifies the unique group identifier
Header
{
"Content-Type": "application/json",
"Authorization": "Bearer <accessToken>"
}
Note: the <accessToken> is obtained as a result of the authentication
Payload
{
"name": "mock-group"
}
Payload structure
type EditGroupPayloadType = {
name: string; // Group name. 1 to 254 characters, unique in the organization (case sensitive)
};
Responses
Correct response
Successful request
Describe the characteristics of a satisfactory response
200
Response structure:
{
// empty response
}
Wrong responses
Unauthorized request
Describe the characteristics of an unauthorized request
401
Response body
{
"message": "Unauthorized"
}
Description: this error occurs when endpoint authorizers fail to validate the token sent in the request header.
Bad request
Describe the characteristics of a bad request
400
Response body
type EditGroupResponseType = {
errorType: UPDATE_GROUP_ERROR_TYPE;
errorMessage: string;
message?: string; // Present on validation errors
details?: object[]; // Present on validation errors
};
enum UPDATE_GROUP_ERROR_TYPE {
INVALID_REQUEST_FORMAT = "invalidRequestFormat", // invalid id, group not found, or body is not valid JSON
INVALID_GROUP_ID = "invalidGroupId", // the group belongs to another organization
REQUIRED_GROUP_NAME = "requiredGroupName", // name missing
INVALID_PARAMETERS = "InvalidParameters", // name empty or longer than 254 characters
GROUP_NAME_ALREADY_EXISTS = "groupNameAlreadyExists", // a group of the organization already has that name
}
errorType | errorMessage | Meaning |
|---|---|---|
invalidRequestFormat | Invalid rol id | the id in the URL is not a valid group identifier |
invalidRequestFormat | Role not found | there is no group with that id |
invalidGroupId | Invalid group id | the group belongs to another organization |
requiredGroupName | Name is missing or empty | name missing |
InvalidParameters | Role name is required | name sent empty |
groupNameAlreadyExists | Group name already exists | a group of your organization already has that name |
A group that does not exist returns 400 with
errorType: "invalidRequestFormat", not 404. Sending the name the group already has also returns groupNameAlreadyExists, so only send this request when the name changes.