(Quick Reference) Service: Save a user

Description: This web service is used to add a new user object to the database

URL:

https://BASE_URL/api/VERSION/users

Method: POST

Request content type: application/json

Parameters:

NameDescriptionTypeRequiredExample values
email StringYes 
password StringYes 
enabledBy default, it is set to truebooleanno 
employeeIdThe ID of employeeLong/Stringyes 
sendEmailnotify the new userbooleanno 
useExternalIdBy default, it is set to false. set it to true if you want to use external ids.Booleannotrue , false

Success Output

Success case: response.status=201
{
    "id": 3,
    "email": "foobar@example.com",
    "firstName": "John",
    "lastName": "Doe",
    "reference": "Ref-01",
    "employee": {
      "id": 3,
      "href": "/api/v2.0/employees/3"
    },
    "enabled": true,
    "organization": "entity1",
    "dateCreated": "2017-01-18T17:18:36Z",
    "lastUpdated": "2017-02-16T17:59:09Z"
}

Failure Output

Failure case:response.status = 400
{
    "error": "missing_param",
    "error_description": "email parameter is missing"
}
{
  "error": "not_unique",
  "error_description": "email already used."
}
{
     "error": "save_failed",
     "error_description": "Failed to save instance"
}

Failure case:response.status = 404

{
  "error": "not_found",
  "error_description": "The employee with the id 1254 doesn't exist."
}

Failure case:response.status = 500
{
     "error": "server_error",
     "error_description": "Oops! Something went wrong..."
}