How to list, create, update, and delete mitto users using curl

Starting in Mitto 2.8 it’s possible to create your own Mitto users using the Mitto API. These users have full admin privileges on Mitto. NOTE: A database user is not created.

In newer versions of Mitto (2.9+) you can see and test all the auth endpoints, including users, using the swagger docs located at: https://{mitto_url}/auth/docs

To use these API endpoints from your local machine you will need the hostname/URL of your Mitto and your mitto API key. You can find your API key by navigating to the settings page in the Mitto UI.

Below are some examples using curl to list, create, update, and delete Mitto users. These commands should work from a terminal in any unix/linux based operating system with network access to mitto:

List Users:

curl -X 'GET' \
  'https://{mitto_url}/api/users?API_KEY={api_key}' \
  -H 'accept: application/json'

HINT: pipe this command into jq for easier readability.

Create a new user:

curl -X 'POST' \
  'https://{mitto_url}/api/users?API_KEY={api_key}' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "username": "bob",
  "name": "bob",
  "password": "PASSWORD"
}'

Update User:
For this command you will need the ID of the user, which you can see by listing users (above). To update a password you should delete and re-create the user.

curl -X 'PUT' \
  'https://{mitto_url}/api/users/{user_id}?API_KEY={api_key}' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "username": "frank",
  "name": "frank"
}'

Delete a user:
For this command you will need the ID of the user, which you can see by listing users (above).

curl -X 'DELETE' \
  'https://{mitto_url}/api/users/{user_id}?API_KEY={api_key}' \
  -H 'accept: */*'