Users API
Users are the accounts that can sign in to the web interface and use the API. Read more about roles in Users and Roles.
User Object
Section titled “User Object”{ "enable": true, "role": "observer"}- enable: Allows the user to sign in. A user with
falsecannot get a token. - role:
adminorobserver. Read more in Roles.
Create a User
Section titled “Create a User”POST /api/userAvailable to admin. The body has the id (login), the password, and the fields of the user.
curl -sS -X POST -H "Authorization: Bearer $TOKEN" \ -H 'Content-Type: application/json' \ 'http://alta.example.com:8100/api/user' \ -d '{"id": "monitoring", "password": "PASSWORD", "enable": true, "role": "observer"}'Returns 204, 400 if the id or the password is empty, or 409 if the user exists.
Get a User
Section titled “Get a User”GET /api/user?id=<user_id>Returns the user object, or 404. The admin and observer roles can read any user. Other users can read only themselves. The response never has the password.
Update a User
Section titled “Update a User”PUT /api/user?id=<user_id>Available to admin. Send the complete object. An administrator cannot change their own role or status: the request returns 422. Ask another administrator to do it.
Delete a User
Section titled “Delete a User”DELETE /api/user?id=<user_id>Available to admin. An administrator cannot delete themselves: the request returns 422.
Reset a Password
Section titled “Reset a Password”POST /api/user/reset-password?id=<user_id>An administrator can change the password of any user. Any other user can change only their own password.
curl -sS -X POST -H "Authorization: Bearer $TOKEN" \ -H 'Content-Type: application/json' \ 'http://alta.example.com:8100/api/user/reset-password?id=monitoring' \ -d '{"password": "NEW-PASSWORD"}'Returns 204, or 404 if the user does not exist. If nobody can sign in as an administrator, read Change Password.