Organizational users

Request must be authenticated with a User having the manager role, and a location_id may be specified. HTTP response is the same as for show action.

Examples

$ curl -i \
  -H "Accept: application/json; version=1" \
  -X POST \
  -H 'Content-type: application/json' \
  -d '{"user": { "username": "[email protected]", "password": "5up3r53kr37", "first_name": "John", "last_name": "Random" }}' \
  https://api.record360.com/api/users

HTTP/1.1 201 Created
Content-Type: application/json; charset=utf-8
Cache-Control: max-age=0, private, must-revalidate

{
  "auth_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIyIiwiaWF0IjoxNDY0MDQxODAzfQ.F33A91GOdYvXfe5fo-Sq3mL-dVGwCyeevd5sceuCLko",
  "user": {
    "id": "42",
    "username": "[email protected]",
    "first_name": "John",
    "last_name": "Random",
    "role": "user",
    "created_at": "2016-05-23T22:16:43.000Z",
    "updated_at": "2016-05-23T22:16:43.000Z",
    "location": { ... }
  }
}

Params

Param name Description
user
required

User attributes

Validations:

  • Must be a Hash

user[username]
required

Username or email address, must be globally unique

Validations:

  • Must be a String

user[password]
required

Password

Validations:

  • Must be a String

user[first_name]
required

First name

Validations:

  • Must be a String

user[last_name]
required

Last name

Validations:

  • Must be a String

user[phone_number]
optional

Phone number

Validations:

  • Must be a String

user[active]
optional , nil allowed

Account enabled? (manager only)

Validations:

  • Must be one of: true, false, 1, 0.

user[location_id]
optional , nil allowed

Location ID (manager only)

Validations:

  • Must be a String

user[external_id]
optional , nil allowed

External ID (manager only)

Validations:

  • Must be a String

user[role]
optional , nil allowed

Role (manager only)

Validations:

  • Must be a String