Patch a Specific Preference
This endpoint patches 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
PATCH /api/v2/user/{user_id}/preference/{id}/
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
user_id | path | string | true | A unique integer value identifying the current user id (can also be used 'me' to identify the user currently authenticated) |
id | path | integer | true | A unique integer value identifying the preference |
body | body | User Preferences | true | The request body should be a json with one of this parameters: key and/or value |
Example Body Parameters
- JSON
{
"key": "string",
"value": "json"
}
Example Request
- JavaScript
- Bash
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: 'PATCH',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
# You can also use wget
curl -X PATCH /api/v2/user/1/preference/1/ \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer {access_token}' \
--DATA '{body}'
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Response status code | User Preferences |
Example responses
- 200
{
"id": "integer",
"user_id": "integer",
"key": "string",
"value": "json",
"created_at": "string",
"last_updated_at": "string"
}