(Quick Reference) Service: Update an assigned route to a customer

Description: This web service is used to update an assigned customer to a route

URL:

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

Method: PUT

Request content type: application/json

Parameters:

NameDescriptionTypeRequiredExample values
idid of the desired record to updateLongYes123
customerIdthe id of customer to be assignedLongYes111
routeIdthe id of the assigned routeLongYes777
rank IntegerYes 

URL with external_id:

https://BASE_URL/api/VERSION/routeCustomers/reference/{routeId}/{customerId}

Parameters:

NameDescriptionTypeRequiredExamples values
routeIdreference of the routeStringYesR-002
customerIdreference of the customerStringYesC-001
rank IntegerYes 

A customer can only be assigned one time to a route

Success Output

Success case: response.status = 200
{
  "id": 7,
  "rank": 4,
  "route": {
    "id": 4,
    "reference": "R-R-001",
    "href": "/api/v1.0/routes/4"
  },
  "customer": {
    "id": 2,
    "reference": "R-CUS2",
    "href": "/api/v1.0/customers/2"
  },
  "organization": "entity1",
  "dateCreated": "2016-10-19T09:33:05Z",
  "lastUpdated": "2016-10-19T09:42:20Z"
}

Failure Output

Failure case:response.status = 400
{
  "error": "invalid_param_type",
  "error_description": "The type of parameter routeId you provided is not valid for this request."
}
{
  "error": "missing_param",
  "error_description": "customerId parameter is missing"
}
{
  "error": "invalid_param_type",
  "error_description": "An invalid value was specified for parameter: rank (must be Integer)"
}
{
  "error": "update_not_authorized",
  "error_description": "the specified route is already assigned to the specified customer"
}
{
  "error": "invalid_param_type",
  "error_description": "An invalid value was specified for parameter: rank of a customer (must be Less than 2)"
}
{
  "error": "save_failed",
  "error_description": "Failed to save instance"
}

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

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