UI Config
API for setup and use configuration for UI components.
Permissions
Permissions for UI Config can be checked by:
| Context | Endpoint | Location | Available perms |
|---|---|---|---|
| Global scope | GET /api/users/permissions/ | ui_config | view, create |
POST /ui-config/component/
Creates or update UI Config for given component. In case that UI Config already exists for given component, existing component content will be overridden by sent payload.
Permissions
Requires authentication and ui_config.create permission.
Request
- URL parameters
| Key | Type | Notes |
|---|---|---|
| component | str | Unique component name. Value is case insensitive. |
In case the component name will contain big letters, all phrase will be saved as lowercase.
- Body parameters
| Key | Type | Notes |
|---|---|---|
| content | str | Content must be a JSON compatible. |
| custom_components | array | Custom Components ids used in UI configuration. |
- Headers
Content-Type: application/json
Authorization: JWT access_token- Schema
json
POST /ui-config/`component`/
{
"content": "{"key": {"value": "value", "value2": "value2"}}",
"custom_components": [1, 2, 3],
"upload_component": [
{
"object_class": 564,
"class_field": 12
}
]
}
<json>Validations
- component
- Max length: 50
- contains only latin letters, digits and dash (a-z0-9-)
- custom_components
- is a integer
- is optional
- values are unique
- max length: 100
- upload_component
- is optional
- max length: 10
- object_class
- is required
- is integer
- exists in DB
- class_field
- is required
- is integer
- exists in DB
- belongs to given object_class
- is of type 'document'
Response
| Key | Type | Notes |
|---|---|---|
| content | str | Contain the same payload which was sent in request. |
- Successful status
201 Created - Response body schema
json
{"key": {"value": "value", "value2": "value2"}}Errors
| Cause | Response code | Message |
|---|---|---|
| Incorrect component in URL | 400 Bad Request | "component": ["Enter a valid value."] |
| Max length 50 cars of component exceeded | 400 Bad Request | 'component': ["Ensure this field has no more than 50 characters."] |
| Invalid payload format | 400 Bad Request | "detail": "JSON parse error - <error_text>" |
| Null value in payload | 400 Bad Request | "content": ["This field may not be null."] |
| Size of payload JSON > 65K characters | 400 Bad Request | "content": ["Ensure this value has at most 65000 characters (it has <len(json)>)."] |
| Number of components > 100 | 400 Bad Request | "detail": ["Limit of 100 UI Config has been exceeded."] |
| custom_components.component missing | 400 Bad Request | "custom_components": {"component": ["This field is required."]} |
| custom_components.component is empty | 400 Bad Request | "custom_components": {"component": ["This field may not be blank."]} |
| custom_components.component is null | 400 Bad Request | "custom_components": {"component": ["This field may not be null."]} |
| custom_components.component doesn't exists | 400 Bad Request | "custom_components": {"component": ["Invalid pk "99900" - object does not exist."]} |
| custom_components.component is not enabled | 400 Bad Request | "custom_components": ["Custom component 1 - object not enabled.",] |
| Insufficient permissions | 403 Forbidden | "detail": "You do not have permission to perform this action." |
| object_class is invalid | 400 Bad Request | "object_class": ["Invalid pk "99999" - object does not exist."] |
| object_class is not int | 400 Bad Request | "object_class": ["Incorrect type. Expected pk value, received str."] |
| object_class is required | 400 Bad Request | "object_class": ["This field is required."] |
| object_class is empty | 400 Bad Request | "object_class": ["This field may not be null."] |
| object_class_field is invalid | 400 Bad Request | "object_class_field": ["Invalid pk "99999" - object does not exist."] |
| object_class_field is not int | 400 Bad Request | "object_class_field": ["Incorrect type. Expected pk value, received str."] |
| object_class_field is required | 400 Bad Request | "object_class_field": ["This field is required."] |
| object_class_field is empty | 400 Bad Request | "object_class_field": ["This field may not be null."] |
| object_class_field is not document type | 400 Bad Request | "object_class_field": ["Invalid type - field "field name" is not Document type."] |
| object_class_field does not belong to object_class | 400 Bad Request | "details": ["Object Class Field ID "field_id" does not belong to Object Class ID "class_id"."] |
| upload component list has duplicatest | 400 Bad Request | "non_field_errors": ["The fields object_class, object_class_field must make a unique set."] |
GET /ui-config/component/
Returns UI Config for given component.
Permissions
Requires authentication and ui_config.view permission. Some component names are public and don't require any authentication.
Public
component- theme
Request
- URL parameters
| Key | Type | Notes |
|---|---|---|
| component | str | Case insensitive component name |
- Headers
Content-Type: application/json
Authorization: JWT access_token- Schema
json
GET /ui-config/`component`/Response
- Successful status
200 OK - Response body schema:
json
<json>Errors
| Error | Response code | Message |
|---|---|---|
| Undefined component in URL | 404 Not Found | "detail": "Not found." |
| Missing component in URL (wrong url) | 403 Forbidden | "detail": "You do not have permission to perform this action." |
| Insufficient permissions | 403 Forbidden | "detail": "You do not have permission to perform this action." |