Skip to main content

User Groups API

General notes

Embeddable fields

NameTypeDescription
usersUser[]Array of related Users.

Content

User groups collection

Single user group

User groups collection

Create user group

POST /api/v0/user-groups

Request

ParamTypeDescriptionRequirements
namestringUser group's nameRequired. Must be a string with a maximal length of 255 characters.
colorstringUser group's color in HEXSometimes. Default is #000000 Maximal length is 9 characters.
POST /api/v0/user-groups HTTP/1.1
Content-Type: application/json

{
"name": "Backend",
"color": "#12345678"
}

Responses

201 CREATED

POST /api/v0/user-groups HTTP/1.1
Content-Type: application/json
Status-Code: 201

{
"id": 1,
"name": "Backend",
"color": "#12345678"
}

422 UNPROCESSABLE ENTITY

Validation error occurred.

POST /api/v0/users HTTP/1.1
Content-Type: application/json
Status-Code: 422

{
"type": "ValidationError",
"message": "The given data was invalid.",
"id": "5c99f70a-e400-44bb-9cd4-592b0a30e145",
"errors": [
{
"field": "name",
"message": "The name field is required."
}
]
}

User groups index

GET /api/v0/user-groups

Request

Index behaviourDefinition
Paginated by defaultNo
Sortingid, name, color
Filtersid:enum, name:string, color:string
GET /api/v0/user-groups HTTP/1.1

Responses

200 OK

GET /api/v0/users HTTP/1.1
Content-Type: application/json
Status-Code: 200

{
"items": [
{
"id": 1,
"name": "Frontend",
"color": "#000000",
"created_at": "2022-12-12T13:21:35+0100",
"updated_at": "2022-12-12T13:21:35+0100",
"_links": [
{
"href": "/api/v0/user-groups/1",
"rel": "self",
"type": "GET"
}
]
}
]
}

Single user group

User group detail

Request

GET /api/v0/user-groups/1 HTTP/1.1

Responses

200 OK

GET /api/v0/user-groups/1 HTTP/1.1
Content-Type: application/json
Status-Code: 200

{
"id": 1,
"name": "Frontend",
"color": "#000000",
"created_at": "2022-12-12T13:21:35+0100",
"updated_at": "2022-12-12T13:21:35+0100",
"_links": [
{
"href": "/api/v0/user-groups/1",
"rel": "self",
"type": "GET"
}
]
}

404 NOT FOUND

User Group was not found.

GET /api/v0/user-groups/2 HTTP/1.1
Content-Type: application/json
Status-Code: 404

{
"type": "NotFound",
"message": "Required model was not found.",
"id": "0cd85449-05fe-4866-9802-8192e6785fc7"
}

Update User group

PUT/PATCH /api/v0/user-groups/{user_group_id}

Request

ParamTypeDescriptionRequirements
namestringUser group's nameRequired. Must be string of maximal length 255 characters.
colorstringUser group's color in HEXSometimes. Default is #000000. Maximum length is 9 characters.

For PATCH method any field can be omitted.

PATCH /api/v0/user-groups/1 HTTP/1.1
Content-Type: application/json

{
"color": "#010101"
}

Responses

200 OK

PUT /api/v0/user-groups/1 HTTP/1.1
Content-Type: application/json
Status-Code: 200

{
"id": 1,
"name": "Frontend",
"color": "#010101",
"created_at": "2022-12-12T13:21:35+0100",
"updated_at": "2022-12-12T14:25:11+0100",
"_links": [
{
"href": "/api/v0/user-groups/1",
"rel": "self",
"type": "GET"
}
]
}

404 NOT FOUND

User group was not found.

PUT /api/v0/user-groups/2 HTTP/1.1
Content-Type: application/json
Status-Code: 404

{
"type": "NotFound",
"message": "Required model was not found.",
"id": "0cd85449-05fe-4866-9802-8192e6785fc7"
}

422 UNPROCESSABLE ENTITY

Validation error occurred.

PUT /api/v0/user-groups/1 HTTP/1.1
Content-Type: application/json
Status-Code: 422

{
"type": "ValidationError",
"message": "The given data was invalid.",
"id": "5c99f70a-e400-44bb-9cd4-592b0a30e145",
"errors": [
{
"field": "name",
"message": "The name field is required."
}
]
}