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
{
  "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
}
Description:
errorTypeerrorMessageMeaning
invalidRequestFormatInvalid rol idthe id in the URL is not a valid group identifier
invalidRequestFormatRole not foundthere is no group with that id
invalidGroupIdInvalid group idthe group belongs to another organization
requiredGroupNameName is missing or emptyname missing
InvalidParametersRole name is requiredname sent empty
groupNameAlreadyExistsGroup name already existsa 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.