(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:
| Name | Description | Type | Required | Example values |
|---|
| id | id of the desired record to update | Long | Yes | 123 |
| userId | the id of user to be assigned | Long | Yes | 1 |
| authorityId | the id of the authority | Long | Yes | 2 |
URL with external_id:
https://BASE_URL/api/VERSION/userAuthorities/reference/{userId}/{authorityId} Parameters:
| Name | Description | Type | Required | Examples values |
|---|
| userId | reference of the user | String | Yes | U-002 |
| authorityId | name of the authority | String | Yes | CEO |
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..."
}