Users endpoint

A GET to /api/open/users allows you to get a list of all the users.

Requirements and Restrictions

  1. The authenticated user must be in a group having admin role.
  2. The result contains the list of all users.
  3. It's possible to use pagination adding page and count params
  4. The page param is the number of the page to return, the count is the dimension of the page.
  5. If count is nil or 0 the default value will be 100, if page is nil or 0 the request will not be paginated.
  6. This api is disabled by default; to enable it add conf.user configure api users enabled true in command-line interface (CLI).
Figure 1. Example of users all request

Example of users all request

A GET to /api/open/user_groups allows you to get a list of all the user groups.

Requirements and Restrictions

  1. The authenticated user must be in a group having admin role.
  2. The result contains the list of all user groups.
  3. It's possible to use pagination adding page and count params
  4. The page param is the number of the page to return, the count is the dimension of the page.
  5. If count is nil or 0 the default value will be 100, if page is nil or 0 the request will not be paginated.
Figure 2. Example of user groups all request

Example of user groups all request

A GET to /api/open/users/:id allows you to get the user having the id passed as path parameter.

Requirements and Restrictions

  1. The authenticated user must be in a group having admin role.
  2. As last parameter of the path you need to specify the id of the user.
  3. The result will contain the user
  4. In case the user with that id is not found you'll get a 404.
Figure 3. Example of users/:id request

Example of users/:id request

A DELETE to /api/open/users/:id allows you to delete the user having the id passed as path parameter.

Requirements and Restrictions

  1. The authenticated user must be in a group having admin role.
  2. As last parameter of the path you need to specify the id of the user.
  3. The result will contain the status code 204 for success else the error code
  4. In case the user with that id is not found you'll get a 404.
Figure 4. Example of delete users/:id request

Example of delete users/:id request

A POST to /api/open/users allows you to create a new user.

Requirements and Restrictions

  1. The authenticated user must be in a group having admin role.
  2. The input must be a JavaScript Object Notation (JSON) dictionary containing the user fields properly populated
  3. username is mandatory and unique.
  4. password is mandatory and have to respect the password strength rules.
  5. user_group_ids is mandatory, must contain at least an id of an existing user-group.
  6. strategy can contain the value "local" or "saml".
  7. is_suspended is a boolean.
  8. should_update_pwd true if the user must update the password when log-in.
  9. ssh_keys is the user secure shell (SSH) key if wants to connect via ssh to the instance.
  10. allow_root_ssh true to allow the user having the ssh_key above to connect via SSH to the instance.
  11. In case the request is well formed return a 201 response with the id of the user created inside the result.
                {
                            "username": "user_under_test22",
                            "password": "aValidP4ss!",
                            "user_group_ids": [2],
                            "strategy": "local",
                            "is_suspended": false,
                            "should_update_pwd": false,
                            "ssh_keys": "an_ssh_key",
                            "allow_root_ssh": true
                }
          
Figure 5. Example of users/ack request

Example of users/ack request

A PUT to /api/open/users/:id allows you to update the user with the id passed as path param.

Requirements and Restrictions

  1. The authenticated user must be in a group having admin role.
  2. As last parameter of the path you need to specify the id of the user you want to update.
  3. The input must be a JSON dictionary containing the user field properly populated
  4. If the update goes well the call return 204 (No content) response
  5. You can't update the password here because updating password is not idempotent so you can't do via PUT.
  6. The fields you can update are listed below.
  7. user_group_ids must contain at least one valid id.
                    {
                        "username": "user_under_test22",
                        "strategy": "local",
                        "user_group_ids": [1,2],
                        "is_suspended": false,
                        "should_update_pwd": false,
                        "ssh_keys": "a_new_key",
                        "allow_root_ssh": true
                    }
              
Figure 6. Example of update users/:id request

Example of update users/:id request

A PATCH to /api/open/users/:id/password allows you to change the password of the user having the id passed as path param.

Requirements and Restrictions

  1. The authenticated user must be in a group having admin role.
  2. The user id should be passed in the path.
  3. You need to pass the new password in the body.
  4. New password must respect the password strength rules.
  5. In case the password is valid will be return an empty response with status code 204.
    {
        "password": "4ValidP4ssw0rd!"
    }
    
Figure 7. Example of users/:id/password request

Example of users/:id/password request