(Quick Reference) Service: Update an assigned user to an authority (role)

Description: This web service is used to update an assigned user to an authority

Method: PUT

Request content type: application/json

URL:

https://BASE_URL/api/VERSION/userAuthorities/{id}

Parameters:

NameDescriptionTypeRequiredExample values
idid of the desired record to updateLongYes123
userIdthe id of user to be assignedLongYes1
authorityIdthe id of the authorityLongYes2

URL with external_id:

https://BASE_URL/api/VERSION/userAuthorities/reference/{userId}/{authorityId}

Parameters:

NameDescriptionTypeRequiredExamples values
userIdreference of the userStringYesU-002
authorityIdname of the authorityStringYesCEO

Success Output

Success case: response.status = 200
{
    "id": 34,
    "user": {
        "id": 37,
        "reference": "test",
        "href": "/api/v2.0/users/37"
    },
    "authority": {
        "id": 21,
        "name": "Sales Director",
        "href": "/api/v2.0/authorities/21"
    },
    "dateCreated": "2017-02-16T10:46:24Z",
    "lastUpdated": "2017-02-16T10:54:51Z"
}

Failure Output

Failure case:response.status = 400
{
    "error": "already_assigned",
    "error_description": "User is already assigned to authority: CEO."
}

{
    "error": "invalid_param_type",
    "error_description": "The type of parameter authorityId you provided is not valid for this request."
}

{
  "error": "save_failed",
  "error_description": "Failed to save instance"
}

Failure case:response.status = 404
{
    "error": "not_found",
    "error_description": "The authority with the id 17000 doesn't exist."
}

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