Managing users

Prev Next

Use the sections that follow to get user roles for your organization and add new users.

Get user roles for your organization

User role ID is a required parameter for the API call to add a new user. To get the list of user roles available in your organization, make the following GET request:

curl -X GET \
  -H 'X-API-KEY:<your_api_key>' \
  -H "Content-type:application/json" \
  'https://<your_company>.manage.iotium.io/api/v2/role' \
  | jq '.results | .[]' | jq '{role_id: .id, name: .name}'

The response includes the names and IDs of all the user roles available in your organization:

{
  "role_id": "<your_readonly_role_id>",
  "name": "Read Only"
}
{
  "role_id": "<your_admin_role_id>",
  "name": "Admin"
}

Add a new user

To add a new user account to your organization, make the following POST request with the request body parameters:

NameTypeRequired or OptionalDescription

name

string

Required

Name of the new user.

email

string

Required

Email address of the new user.

When you add a new user, he or she automatically receives an email with a link to verify their email address. New users cannot login until they’ve verified their email address.

password

string

Required

Password for the new user.

Once the new users verify their email address and login, they will be asked to change their passwords on first login.

roles

array

Required

List of roles for the new user.

In this example, the new user has admin role.

curl -X POST \
  -H 'X-API-KEY:<your_api_key>' \
  -H "Content-type:application/json" \
  -d '{"name":"<your_newuser_name>", \
       "email":"<your_newuser_email>", \
       "password":"<your_newuser_password>", \
       "roles":["<your_admin_role_id>"]}' \
  'https://<your_company>.manage.iotium.io/api/v1/user' \
  | jq '{id:.id, name:.name, role:.roles}'

The response includes the name and ID of the new user, and the name and ID of the new user's role:

{
  "id": "<your_newuser_id>",
  "name": "<your_newuser_name>",
  "role": [
    {
      "id": "<your_admin_role_id>",
      "name": "Admin"
    }
  ]
}