(Quick Reference)
Service: Assign an assigned customer to a new employee
Description: This web service is used to update an assigned customer to an employee to the database
Method: PUT
Request content type: application/json
URL:
https://BASE_URL/api/VERSION/customerEmployees/{id}
Parameters:
Name | Description | Type | Required | Example values |
---|
id | id of the desired record | Long | Yes | 111 |
userId | the id of the employee | Long | Yes | 777 |
customerId | the id of the customer to assign | Long | Yes | 777 |
URL with external_id:
https://BASE_URL/api/VERSION/customerEmployees/reference/{customerId}/{userId}
Parameters:
Name | Description | Type | Required | Examples values |
---|
customerId | reference of the customer | String | Yes | CC-002 |
userId | reference of the user | String | Yes | U-001 |
Success Output
Success case: response.status=201
{
"id": 569,
"customerReference": "C-002",
"employeeReference": "Ref 6654",
"customer": {
"id": 1335,
"reference": "C-002",
"name": "Joe",
"href": "/api/v1.0/customers/1335"
},
"user": {
"id": 8,
"reference": "Ref 6654",
"href": "/api/v1.0/users/8"
},
"organization": "Lyon",
"dateCreated": "2016-08-22T09:42:11Z",
"lastUpdated": "2016-08-22T10:38:40Z"
}
Failure Output
Failure case:response.status = 400
{
"error": "missing_param",
"error_description": "userId parameter is missing"
}
"error": "already_assigned",
"error_description": "customer is already assigned to employee."
{
"error": "save_failed",
"error_description": "Failed to save instance"
}
{
"error": "update_not_authorized",
"error_description": "the current customer and employee are assigned to route"
}
Failure case:response.status = 404
{
"error":"not_found",
"error_description": "The user with the id 999 doesn't exist."
}
Failure case:response.status = 500
{
"error": "server_error",
"error_description": "Oops! Something went wrong..."
}