Update User Role
PATCH
/admin/users/{user_id}/role
const url = 'http://localhost:8000/admin/users/1/role';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"role":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url http://localhost:8000/admin/users/1/role \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "role": "example" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”user_id
required
User Id
integer
Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
UserRoleUpdate
object
role
required
Role
string
Examplegenerated
{ "role": "example"}Responses
Section titled “Responses”Successful Response
Media typeapplication/json
UserResponse
object
Example
{ "role": "user"}Validation Error
Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationErrorobject
ctx
Context
object
input
Input
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
Examplegenerated
{ "detail": [ { "ctx": {}, "input": "example", "loc": [ "example" ], "msg": "example", "type": "example" } ]}