Change a user
const url = 'http://localhost:8080/api/v1/users/1';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"password":"example","role":"admin","libraryIds":[1]}'};
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:8080/api/v1/users/1 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "password": "example", "role": "admin", "libraryIds": [ 1 ] }'Admin only. Setting a password signs that user out everywhere.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
At least 8 characters and at most 1024 bytes.
Responses
Section titled “Responses”The changed user.
object
Libraries a reader may open. Empty for admins, who see every library.
True on /api/v1/me for a shared demo account, which can’t change its settings. Absent otherwise.
Example
{ "role": "admin"}The request was malformed.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}The request has no valid session token.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}The signed-in user may not do this. demo_account when the user is a
shared demo account, named in CHEK_DEMO_USERS, which can’t change
its password, sessions, sign-in providers, extensions or annotations.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}The resource does not exist.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}The change would leave the server without an admin.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}The server failed; details are in its log.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}