Skip to main content

Update a Specific Preference

This endpoint updates a specific user preference

info

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

HTTP Request

PUT /api/v2/user/{user_id}/preference/{id}/

Parameters

NameInTypeRequiredDescription
user_idpathstringtrueA unique integer value identifying the current user id (can also be used 'me' to identify the user currently authenticated)
idpathintegertrueA unique integer value identifying the preference
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/1/',
{
method: 'PUT',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});

Responses

StatusMeaningDescriptionSchema
200OKResponse status codeUser Preferences

Example responses

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