(Quick Reference) Service: Assign a route to a customer

Description: This web service is used to assign a list of customers to a route whitch each one of them is not assigned before

URL:

https://BASE_URL/api/VERSION/routeCustomers

Method: POST

Request content type: application/json

Parameters:

NameDescriptionTypeRequiredExample values
routeIdthe id of the assigned routeLong/StringYes777
customersA list of couple (id,rank) of customerArrayYes{id:1,rank:2},{id:"C-001",rank:1}
useExternalIdBy default, it is set to false. set it to true if you want to use external ids.Booleannotrue , false

A customer can only be assigned one time to a route
Each customer of the same route has a unique rank

Success Output

Success case: response.status = 201
[
  {
    "id": 12,
    "rank": 1,
    "route": {
      "id": 2,
      "reference": "R-RT-001",
      "href": "/api/v1.0/routes/2"
    },
    "customer": {
      "id": 2,
      "reference": "R-CUS2",
      "href": "/api/v1.0/customers/2"
    },
    "organization": "entity1",
    "dateCreated": "2016-10-26T13:43:48Z",
    "lastUpdated": "2016-10-26T13:43:48Z"
  },
  {
    "id": 13,
    "rank": 2,
    "route": {
      "id": 2,
      "reference": "R-RT-001",
      "href": "/api/v1.0/routes/2"
    },
    "customer": {
      "id": 19,
      "reference": "R-C-003",
      "href": "/api/v1.0/customers/19"
    },
    "organization": "entity1",
    "dateCreated": "2016-10-26T13:43:48Z",
    "lastUpdated": "2016-10-26T13:43:48Z"
  }
]

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": "routerId parameter is missing"
}
{
  "error": "invalid_param_type",
  "error_description": "An invalid value was specified for parameter: rank of a customer (must be Less than 2)"
}
{
  "error": "invalid_param_type",
  "error_description": "An invalid value was specified for parameter: rank (must be Integer)"
}
{
{
  "error": "not_unique",
  "error_description": "rank already used"
}
}
{
  "error": "save_not_authorized",
  "error_description": "the specified route is already assigned to the specified customer"
}
{
  "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..."
}