User Preferences
User preferences are collection of a user frontend application layout settings. Under keys managed by fronted application are stored information about tables columns, sorting, filtering and other any user layout settings.
POST /api/users/preferences/key/
Creates or override authenticated user preferences for passed key.
Permissions
Requires authentication.
Request
- URL parameters
| Key | Type | Notes |
|---|---|---|
| key | string | Any string following regexp rule a-zA-z0-9\-\\ and length 255 |
- Body parameters
| Key | Type | Notes |
|---|---|---|
| preferences | string | required |
- Headers
Content-Type: application/json
Authorization: JWT access_token- Schema
json
POST /api/users/preferences/`key`/
{
"preferences": <string>
}Sample request body
json
POST /api/users/preferences/key/
{
"preferences": "{\"tables\": [1,2]}"
}Validations
- preferences
- Max length: 110000
- key
- Max length: 255
- Regexp
a-zA-Z0-9\-\\
Response
Empty response body
- Successful status
201 Created
Errors
| Cause | Response code | Message |
|---|---|---|
| Max 5000000 User Preferences exceeded per user | 400 Bad Request | "detail": ["Limit of 5000000 User Preferences for the User has been exceeded."] |
Max 110000 characters in performance value exceeded | 400 Bad Request | "preferences": ["Ensure this field has no more than 110000 characters."] |
performance value can't be null | 400 Bad Request | "preferences": ["This field may not be null."] |
performance is required in request data | 400 Bad Request | "preferences": ["This field is required."] |
Max 255 characters in key exceeded | 400 Bad Request | "key": ["Ensure this field has no more than 255 characters."] |
key value contains not allowed characters. Allowed are a-z, A-Z, -, \ | 400 Bad Request | "key": ["Enter a valid value."] |
GET /api/users/preferences/key/
Returns user preferences for passing key.
Permissions
Requires authentication.
Request
- Headers
Content-Type: application/json
Authorization: JWT access_token- Schema
json
GET /api/users/preferences/`key`/Response
| Key | Type | Notes |
|---|---|---|
| preferences | string |
- Successful status
200 OK - Response body schema
json
{
"preferences": <string>
}Sorting
Not supported
Filtering
Not supported
Errors
| Error | Response code | Message |
|---|---|---|
| User Permissions with key for authenticated user does not exist | 404 Not Found | "detail": "Not found." |