Create a user
const url = 'http://localhost:8080/api/v1/users';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","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 POST \ --url http://localhost:8080/api/v1/users \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "password": "example", "role": "admin", "libraryIds": [ 1 ] }'Admin only.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
At least 8 characters and at most 1024 bytes.
Libraries a reader may open. Ignored for admins.
Responses
Section titled “Responses”The user was created.
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"}A user with that name already exists.
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"}