(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:

NameDescriptionTypeRequiredExample values
idid of the desired recordLongYes111
userIdthe id of the employeeLongYes777
customerIdthe id of the customer to assignLongYes777

URL with external_id:

https://BASE_URL/api/VERSION/customerEmployees/reference/{customerId}/{userId}

Parameters:

NameDescriptionTypeRequiredExamples values
customerIdreference of the customerStringYesCC-002
userIdreference of the userStringYesU-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..."
}