Skip to main content
Version: Management Center 2.4

User Management REST API

2.3
Premium

This page describes how to use the User Management REST API. Using this API you can automatically create, read, update and delete users that can access the Management Center.

info

Before sending command request make sure that you have been authenticated.

Get users

To get a list of all users, send a GET request to the /api/user-management/users endpoint, as shown in the following curl command:

curl --cookie .cookies \
--request GET <BASE_URL>/api/user-management/users\
-H 'Content-Type: application/json'

Example:

curl --cookie-jar .cookies \
--request POST http://localhost:8088/auth \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d "username=admin&password=secret"

The response has the following structure:

[
{
"username": "admin",
"roles": [
"admin"
]
},
{
"username": "bob",
"roles": [
"viewer"
]
}
]

Add user

To add a user, send a POST request to the /api/user-management/users endpoint:

curl --cookie .cookies \
--request POST <BASE_URL>/api/user-management/users \
-H 'Content-Type: application/json' \
-d '{ "username": "bob", "password": "secret", "roles": ["viewer"]}'

Example:

curl --cookie .cookies \
--request POST http:/localhost:8088/api/user-management/users \
-H 'Content-Type: application/json' \
-d '{ "username": "bob", "password": "secret", "roles": ["viewer"]}'

Example response:

[
{
"username": "admin",
"roles": [
"admin"
]
},
{
"username": "bob",
"roles": [
"viewer"
]
}
]

Get user

To get the details of a single user, send a GET request to the /api/user-management/users/<USER_NAME> endpoint and replace <USER_NAME> with the name of the user:

curl --cookie .cookies \
--request GET <BASE_URL>/api/user-management/users/<USER_NAME> \
-H 'Content-Type: application/json'

Example:

curl --cookie .cookies \
--request GET http:/localhost:8088/api/user-management/users/admin \
-H 'Content-Type: application/json'

Example response:

{
"username": "admin",
"roles": [
"admin"
]
}

Edit user

To update the details of a single user, send a PUT request to the /api/user-management/users/<USER_NAME> endpoint and replace <USER_NAME> with the name of the user:

curl --cookie .cookies \
--request PUT <BASE_URL>/api/user-management/users/<USER_NAME> \
-H 'Content-Type: application/json' \
-d '{ "password": "newSecretPassword" }'

Example:

curl --cookie .cookies \
--request PUT http:/localhost:8088/api/user-management/users/bob \
-H 'Content-Type: application/json' \
-d '{ "password": "newSecretPassword" }'

Delete user

To delete a single user, send a DELETE request to the /api/user-management/users/<USER_NAME> endpoint and replace <USER_NAME> with the name of the user:

curl --cookie .cookies \
--request PUT <BASE_URL>/api/user-management/users/<USER_NAME> \
-H 'Content-Type: application/json' \
-d '{ "password": "newSecretPassword" }'

Example:

curl --cookie .cookies \
--request DELETE http:/localhost:8088/api/user-management/users/bob \
-H 'Content-Type: application/json'

Deauthenticate / Logout

See the process described here.