User Groups API
General notes
Embeddable fields
| Name | Type | Description |
|---|---|---|
users | User[] | Array of related Users. |
Content
User groups collection
Single user group
User groups collection
Create user group
POST /api/v0/user-groups
Request
| Param | Type | Description | Requirements |
|---|---|---|---|
name | string | User group's name | Required. Must be a string with a maximal length of 255 characters. |
color | string | User group's color in HEX | Sometimes. 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 behaviour | Definition |
|---|---|
| Paginated by default | No |
| Sorting | id, name, color |
| Filters | id: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
| Param | Type | Description | Requirements |
|---|---|---|---|
name | string | User group's name | Required. Must be string of maximal length 255 characters. |
color | string | User group's color in HEX | Sometimes. 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."
}
]
}