Create group
Request description
Endpoint: /users/groups/create
Method: POST
Header
{
"Content-Type": "application/json",
"Authorization": "Bearer <accessToken>"
}
Note: the <accessToken> is obtained as a result of the authentication
Payload
{
"name": "mock-group-name"
}
Payload structure
type CreateGroupPayloadType = {
name: string; // Group name. 1 to 254 characters, unique in the organization (case sensitive)
};
Note: the response does not include the identifier of the new group. Use Group list to get it.
Responses
Correct response
Successful request
Describe the characteristics of a satisfactory response
201
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 CreateGroupResponseType = {
errorType: CREATE_GROUP_ERROR_TYPE;
errorMessage: string;
message?: string; // Present on validation errors
details?: object[]; // Present on validation errors
};
enum CREATE_GROUP_ERROR_TYPE {
REQUIRED_GROUP_NAME = "requiredGroupName", // name missing
INVALID_PARAMETERS = "InvalidParameters", // name empty or longer than 254 characters
GROUP_NAME_ALREADY_EXISTS = "groupNameAlreadyExists", // another group of the organization has the same name
INVALID_REQUEST_FORMAT = "invalidRequestFormat", // body is not valid JSON
}
errorType | errorMessage | Meaning |
|---|---|---|
requiredGroupName | Name is missing or empty | name missing |
InvalidParameters | Role name is required | name sent empty |
InvalidParameters | — | name longer than 254 characters |
groupNameAlreadyExists | Group name already exists | another group of your organization has the same name |