Settings API
Content
Settings collection:
Single setting:
Settings collection
Settings index
GET /api/v0/settings
Get list of existing Settings.
Request
| Index behaviour | Definition |
|---|---|
| Paginated by default | No |
| Sorting | id, value, created_at, updated_at |
| Filters | id:enum, value:string, created_at:date, updated_at:date |
| Embedded | - |
GET /api/v0/settings HTTP/1.1
Responses
200 OK
GET /api/v0/settings HTTP/1.1
Content-Type: application/json
Status-Code: 200
{
"items": [
{
"id": 1,
"value": "Example",
"created_at": "2022-11-25T13:52:59+0100",
"updated_at": "2022-11-25T13:52:59+0100",
"_links": [
{
"href": "/api/v0/settings/1",
"rel": "self",
"type": "GET"
}
]
}
]
}
Single Setting
Setting detail
GET /api/v0/settings/{setting_id}
Get Setting detail.
Request
GET /api/v0/settings/1 HTTP/1.1
Responses
200 OK
GET /api/v0/settings/1 HTTP/1.1
Content-Type: application/json
Status-Code: 200
{
"id": 1,
"value": "Example",
"created_at": "2022-11-25T13:52:59+0100",
"updated_at": "2022-11-25T13:52:59+0100",
"_links": [
{
"href": "/api/v0/settings/1",
"rel": "self",
"type": "GET"
}
]
}
404 NOT FOUND
Setting was not found.
GET /api/v0/settings/10 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 Setting
PUT/PATCH /api/v0/settings/{setting_id}
This method needs permission
updateonsettings.
Method for updating Setting data.
Request
| Param | Type | Description | Requirements |
|---|---|---|---|
value | bool | Value of setting | Required. |
For PATCH method any field can be omitted.
PUT /api/v0/settings/1 HTTP/1.1
Content-Type: application/json
{
"value": "Test",
}
Responses
200 OK
Setting successfully updated.
PUT /api/v0/settings/1 HTTP/1.1
Content-Type: application/json
Status-Code: 200
{
"id": 1,
"value": "Test",
"created_at": "2022-11-25T13:52:59+0100",
"updated_at": "2022-11-25T13:52:59+0100",
"_links": [
{
"href": "/api/v0/settings/1",
"rel": "self",
"type": "GET"
}
]
}
404 NOT FOUND
setting was not found.
PUT /api/v0/settings/1 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/settings/1 HTTP/1.1
Content-Type: application/json
Status-Code: 422
{
"type": "ValidationError",
"message": "The given data was invalid.",
"id": "ad659bbb-608c-4cf9-8e5b-2b3078b25beb",
"errors": [
{
"field": "is_default",
"message": "Set another currency as default."
}
]
}