Skip to content

Authentication

Retrieve whether authentication is turned on.

GET /api/users/auth_status
curl -X GET "http://127.0.0.1:8080/api/users/auth_status" \
-u admin:admin
true

Boolean value describes the status of the authentication.

Retrieve the username of the current user.

GET /api/users/username
curl -X GET "http://127.0.0.1:8080/api/users/username" \
-u admin:admin
"admin"

String representation of the username.

Retrieve the pass used to authenticate the current user via WebSocket.

GET /api/users/pass
curl -X GET "http://127.0.0.1:8080/api/users/pass" \
-u admin:admin
"7f9449854c2fef8d14de44f84a753c49"

String representation of the WebSocket pass.

Retrieve whether the current user is admin (only when authentication is enabled).

GET /api/users/is_admin
curl -X GET "http://127.0.0.1:8080/api/users/is_admin" \
-u admin:admin
true

Return true if authentication is enabled and the current user is admin. Otherwise return false.

Retrieve the role of the specified user. This can be one of the following: guest, user, admin.

GET /api/users/role/USERNAME
curl -X GET "http://127.0.0.1:8080/api/users/role/admin" \
-u admin:admin
admin
Argument Description
username Required. The string value of the username.

If successful, the response is the role of the user.

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"}

Retrieve a list of rights. These can be read, write or execute.

GET /api/users/rights/USERNAME
curl -X GET "http://127.0.0.1:8080/api/users/rights/admin" \
-u admin:admin
[]
Argument Description
username Required. The string value of the username.

If successful, the response is a list of rights belongs to the user specified in the request.

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"}

Change the password of the current user.

POST /api/users/change_password
{
"password": "PASSWORD"
}
curl -X POST "http://127.0.0.1:8080/api/users/change_password" \
-H "Content-Type: application/json" \
-d "{\"password\":\"newPassword12\"}" \
-u admin:admin
true
Argument Description
password Required. The string value of the new password.

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"}

Password can consist of letters and numbers.

Set the role of the specified user. Request is restricted to admin.

POST /api/users/change_role
{
"username" : "USERNAME",
"role" : "ROLE"
}
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:admin
true
Argument Description
username Required. The string value of the username.
role Required. The string value of the role.

If successful, the HTTP response is 200 OK. Otherwise, HTTP 400 is sent with an error object:

{"errror" : "ERROR_REASON_STR"}

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 the rights of the specified user. Request is restricted to admin.

POST /api/users/change_rights
{
"username" : "USERNAME",
"rights" : ["RIGHT"]
}
curl -X POST "http://127.0.0.1:8080/api/users/change_rights" \
-H "Content-Type: application/json" \
-d "{\"username\":\"admin\",
\"rights\":[]}" \
-u admin:admin
true
Argument Description
username Required. The string value of the username.
rights Required. A list of rights as string values.

If successful, the HTTP response is 200 OK. Otherwise, HTTP 400 is sent with an error object:

{"error" : "ERROR_REASON_STR"}

Request is restricted to admin. If another user sends this request then HTTP 400 is sent with an error object:

{"error" : "ERROR_REASON_STR"}

Retrieve a list of registered users.

GET /api/users/list_users
curl -X GET "http://127.0.0.1:8080/api/users/list_users" \
-u admin:admin
{
["admin","user2","user"]
}

The array of the registered users’s username. Usernames are represented as strings.

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 a new user with the specified credentials.

POST /api/users/add_user
{
"username": "USERNAME"
"password": "PASSWORD"
}
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:admin
true
Argument Description
username Required. The string value of the username.
password Required. The string value of the password.

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"}

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 the specified user.

DELETE /api/users/delete_user/USERNAME

or

DELETE /api/users/delete_user/USERNAME?with_pages=true

none

curl -X DELETE "http://127.0.0.1:8080/api/users/delete_user/newUser?with_pages=true" \
-u admin:admin
true
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.

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"}

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"}