(Quick Reference) Service: Assign a route to an employee

Description: This web service is used to assign an employee which is not assigned before to a route

URL:

https://BASE_URL/api/VERSION/userAuthorities

Method: POST

Request content type: application/json

Parameters:

NameDescriptionTypeRequiredExample values
userIdthe id of user to be assignedLong/StringYes1
authorityIdthe id of the authorityLong/StringYes2
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": 34,
    "user": {
        "id": 37,
        "reference": "test",
        "href": "/api/v2.0/users/37"
    },
    "authority": {
        "id": 19,
        "name": "Marketing Director",
        "href": "/api/v2.0/authorities/19"
    },
    "dateCreated": "2017-02-16T10:46:24Z",
    "lastUpdated": "2017-02-16T10:46:24Z"
}

Failure Output

Failure case:response.status = 400
{
    "error": "invalid_param_type",
    "error_description": "The type of parameter authorityId you provided is not valid for this request."
}
{
    "error": "missing_param",
    "error_description": "userId parameter is missing"
}
{
    "error": "already_assigned",
    "error_description": "User is already assigned to authority: ADMIN."
}
{
  "error": "save_failed",
  "error_description": "Failed to save instance"
}

Failure case:response.status = 404
{
    "error": "not_found",
    "error_description": "The user with the id 11111 doesn't exist."
}
Failure case:response.status = 500
{
  "error": "server_error",
  "error_description": "Oops! Something went wrong..."
}