Authentication
- Get the authentication status
- Get username of the current user
- Get websocket pass of the current user
- Get whether current user is admin
- Get role of the specified user
- Get rights of the specified user
- Set new password for the current user
- Set role of the specified user
- Set rights of the specified user
- Get the list of registered users
- Add new user
- Delete user
Get the authentication status
Section titled “Get the authentication status”Retrieve whether authentication is turned on.
Definition
Section titled “Definition”GET /api/users/auth_statusExample request
Section titled “Example request”curl -X GET "http://127.0.0.1:8080/api/users/auth_status" \ -u admin:adminExample response
Section titled “Example response”trueReturns
Section titled “Returns”Boolean value describes the status of the authentication.
Get username of the current user
Section titled “Get username of the current user”Retrieve the username of the current user.
Definition
Section titled “Definition”GET /api/users/usernameExample request
Section titled “Example request”curl -X GET "http://127.0.0.1:8080/api/users/username" \ -u admin:adminExample response
Section titled “Example response”"admin"Returns
Section titled “Returns”String representation of the username.
Get WebSocket pass of the current user
Section titled “Get WebSocket pass of the current user”Retrieve the pass used to authenticate the current user via WebSocket.
Definition
Section titled “Definition”GET /api/users/passExample request
Section titled “Example request”curl -X GET "http://127.0.0.1:8080/api/users/pass" \ -u admin:adminExample response
Section titled “Example response”"7f9449854c2fef8d14de44f84a753c49"Returns
Section titled “Returns”String representation of the WebSocket pass.
Get whether current user is admin
Section titled “Get whether current user is admin”Retrieve whether the current user is admin (only when authentication is enabled).
Definition
Section titled “Definition”GET /api/users/is_adminExample request
Section titled “Example request”curl -X GET "http://127.0.0.1:8080/api/users/is_admin" \ -u admin:adminExample response
Section titled “Example response”trueReturns
Section titled “Returns”Return true if authentication is enabled and the current user is admin. Otherwise return false.
Get role of the specified user
Section titled “Get role of the specified user”Retrieve the role of the specified user. This can be one of the following: guest, user, admin.
Definition
Section titled “Definition”GET /api/users/role/USERNAMEExample request
Section titled “Example request”curl -X GET "http://127.0.0.1:8080/api/users/role/admin" \ -u admin:adminExample response
Section titled “Example response”adminArguments
Section titled “Arguments”| Argument | Description |
|---|---|
| username | Required. The string value of the username. |
Returns
Section titled “Returns”If successful, the response is the role of the user.
Limitations
Section titled “Limitations”Request is restricted to admin and the specified user. If a non-admin user sends this request with another username then HTTP 400 is sent with an error object:
{"error" : "ERROR_REASON_STR"}Get rights of the specified user
Section titled “Get rights of the specified user”Retrieve a list of rights. These can be read, write or execute.
Definition
Section titled “Definition”GET /api/users/rights/USERNAMEExample request
Section titled “Example request”curl -X GET "http://127.0.0.1:8080/api/users/rights/admin" \ -u admin:adminExample response
Section titled “Example response”[]Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
| username | Required. The string value of the username. |
Returns
Section titled “Returns”If successful, the response is a list of rights belongs to the user specified in the request.
Limitations
Section titled “Limitations”Request is restricted to admin and the specified user. If a non-admin user sends this request with another username then HTTP 400 is sent with an error object:
{"error" : "ERROR_REASON_STR"}Set new password for the current user
Section titled “Set new password for the current user”Change the password of the current user.
Definition
Section titled “Definition”POST /api/users/change_password{ "password": "PASSWORD"}Example request
Section titled “Example request”curl -X POST "http://127.0.0.1:8080/api/users/change_password" \ -H "Content-Type: application/json" \ -d "{\"password\":\"newPassword12\"}" \ -u admin:adminExample response
Section titled “Example response”trueArguments
Section titled “Arguments”| Argument | Description |
|---|---|
| password | Required. The string value of the new password. |
Returns
Section titled “Returns”If successful, the HTTP response is 200 OK. The new password is stored. Otherwise, HTTP 400 is sent with an error object:
{"error" : "ERROR_REASON_STR"}Limitations
Section titled “Limitations”Password can consist of letters and numbers.
Set role of the specified user
Section titled “Set role of the specified user”Set the role of the specified user. Request is restricted to admin.
Definition
Section titled “Definition”POST /api/users/change_role{ "username" : "USERNAME", "role" : "ROLE"}Example request
Section titled “Example request”curl -X POST "http://127.0.0.1:8080/api/users/change_role" \ -H "Content-Type: application/json" \ -d "{\"username\":\"admin\", \"role\":\"admin\"}" \ -u admin:adminExample response
Section titled “Example response”trueArguments
Section titled “Arguments”| Argument | Description |
|---|---|
| username | Required. The string value of the username. |
| role | Required. The string value of the role. |
Returns
Section titled “Returns”If successful, the HTTP response is 200 OK. Otherwise, HTTP 400 is sent with an error object:
{"errror" : "ERROR_REASON_STR"}Limitations
Section titled “Limitations”Request is restricted to admin. If other user sends this request then HTTP 400 is sent with an error object:
{"error" : "ERROR_REASON_STR"}Set rights of the specified user
Section titled “Set rights of the specified user”Set the rights of the specified user. Request is restricted to admin.
Definition
Section titled “Definition”POST /api/users/change_rights{ "username" : "USERNAME", "rights" : ["RIGHT"]}Example request
Section titled “Example request”curl -X POST "http://127.0.0.1:8080/api/users/change_rights" \ -H "Content-Type: application/json" \ -d "{\"username\":\"admin\", \"rights\":[]}" \ -u admin:adminExample response
Section titled “Example response”trueArguments
Section titled “Arguments”| Argument | Description |
|---|---|
| username | Required. The string value of the username. |
| rights | Required. A list of rights as string values. |
Returns
Section titled “Returns”If successful, the HTTP response is 200 OK. Otherwise, HTTP 400 is sent with an error object:
{"error" : "ERROR_REASON_STR"}Limitations
Section titled “Limitations”Request is restricted to admin. If another user sends this request then HTTP 400 is sent with an error object:
{"error" : "ERROR_REASON_STR"}Get the list of registered users
Section titled “Get the list of registered users”Retrieve a list of registered users.
Definition
Section titled “Definition”GET /api/users/list_usersExample request
Section titled “Example request”curl -X GET "http://127.0.0.1:8080/api/users/list_users" \ -u admin:adminExample response
Section titled “Example response”{ ["admin","user2","user"]}Returns
Section titled “Returns”The array of the registered users’s username. Usernames are represented as strings.
Limitations
Section titled “Limitations”Request is restricted to admin. If other user sends this request then HTTP 400 is sent with an error object:
{"error" : "ERROR_REASON_STR"}Add new user
Section titled “Add new user”Add a new user with the specified credentials.
Definition
Section titled “Definition”POST /api/users/add_user{ "username": "USERNAME" "password": "PASSWORD"}Example request
Section titled “Example request”curl -X POST "http://127.0.0.1:8080/api/users/add_user" \ -H "Content-Type: application/json" \ -d "{\"password\":\"newPassword12\", \"username\":\"newUser\"}" \ -u admin:adminExample response
Section titled “Example response”trueArguments
Section titled “Arguments”| Argument | Description |
|---|---|
| username | Required. The string value of the username. |
| password | Required. The string value of the password. |
Returns
Section titled “Returns”If successful, the HTTP response is 200 OK. The new user is stored with the specified credentials. Otherwise, HTTP 400 is sent with an error object:
{"error" : "ERROR_REASON_STR"}Limitations
Section titled “Limitations”Username and password can consist of letters and numbers.
Request is restricted to admin. If other user sends this request then HTTP 400 is sent with an error object:
{"error" : "ERROR_REASON_STR"}Delete user
Section titled “Delete user”Delete the specified user.
Definition
Section titled “Definition”DELETE /api/users/delete_user/USERNAMEor
DELETE /api/users/delete_user/USERNAME?with_pages=truenone
Example request
Section titled “Example request”curl -X DELETE "http://127.0.0.1:8080/api/users/delete_user/newUser?with_pages=true" \ -u admin:adminExample response
Section titled “Example response”trueArguments
Section titled “Arguments”| Argument | Description |
|---|---|
| username | Required. The string value of the username. |
| with_pages | Optional. If defined and the value is true then the front pages owned by the user will be deleted. Otherwise, the new owner will be the admin user. |
Returns
Section titled “Returns”If successful, the HTTP response is 200 OK. The user is deleted. Otherwise, HTTP 400 is sent with an error object:
{"error" : "ERROR_REASON_STR"}Limitations
Section titled “Limitations”Username can consist of letters and numbers.
Request is restricted to admin. If other user sends this request then HTTP 400 is sent with an error object:
{"error" : "ERROR_REASON_STR"}