Skip to main content

Create a Preference

This endpoint creates a user preference

info

This operation requires that the user authenticated is the same as {id} or that the user has the admin role.

HTTP Request

POST /api/v2/user/{id}/preference/

Parameters

NameInTypeRequiredDescription
idpathstringtrueA unique integer value identifying the current user id (can also be used 'me' to identify the user currently authenticated)
bodybodyUser PreferencestrueThe request body should be a json with two parameters: key and value

Example Body Parameters

{
"key": "string",
"value": "json"
}

Example Request


const inputBody = '{
"key": "string",
"value": "json"
}';
const headers = {
'Content-Type':'application/x-www-form-urlencoded',
'Accept':'application/json',
'Authorization': 'Bearer {access_token}'
};

fetch('/api/v2/user/1/preference/',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});

Responses

StatusMeaningDescriptionSchema
201CreatedResponse status codeUser Preferences

Example responses

{
"id": "integer",
"user_id": "integer",
"key": "string",
"value": "json",
"created_at": "string",
"last_updated_at": "string"
}