iotoms Docs

Create a user

POST
/api/v1/management/users

Creates a back-office user and returns 201 with the profile. The username must be unique, the password needs upper and lower case, a digit and a special character, and a 4 to 6 digit PIN is required when enablePin is true.

How to use it

  1. Pick a roleId from List roles; it must not grant more access than your own role.
  2. Send a unique username, a strong password, the roleId and, if enablePin is true, a 4 to 6 digit pin.
  3. The user is created as active unless you send status inactive. Returns 201 with the profile; the password and PIN are stored only as hashes.

Authorization

BearerAuth
headerAuthorizationBearer <JWT>

Request Body

application/json
  1. body
username*string

Sign-in username, 3 to 255 characters. Required and must be unique.

Length3 <= length <= 255
password*string

Initial password. Required. At least 8 characters with upper and lower case letters, a digit and a special character (@$!%*?&._^#).

Match^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&._^#])[A-Za-z\d@$!%*?&._^#]+$
Length8 <= length <= 255
roleId*integer

Role ID from List roles. Required. You cannot assign a role with more access than your own.

Formatint64
enablePin*boolean

True to let the user also use a numeric PIN. Defaults to false.

pin?|

PIN of 4 to 6 digits. Required when enablePin is true.

Match^\d{4,6}$
firstName?|

First name, up to 255 characters. Optional.

Length0 <= length <= 255
lastName?|

Last name, up to 255 characters. Optional.

Length0 <= length <= 255
email?|

Email address. Optional; must be a valid email.

status?|

Account status: active or inactive (case-insensitive). Defaults to active.

Match^(?i)(active|inactive)$

Response Body

OK

*/*
  1. response
status*string

Outcome of the call: SUCCESS when the request worked, ERROR when it did not.

message*string

Short human-readable message describing the result, for logs or display; do not parse it.

data?

The user's profile as it now stands. Passwords and PINs are never returned.

Example Request
curl -X POST 'https://beta.iotoms.com/api/v1/management/users' \  -H 'Content-Type: application/json' \  -d '{  "username": "string",  "password": "stringst",  "roleId": 0,  "enablePin": true}'
Example Response
{  "status": "string",  "message": "string",  "data": {    "userId": 0,    "username": "string",    "roleId": 0,    "enablePin": true,    "firstName": "string",    "lastName": "string",    "email": "string",    "passwordUpdatedOn": "2019-08-24T14:15:22Z",    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z",    "status": "string"  }}