(Quick Reference) Service: Create a new route

Description: This web service is used to add a new route object to the database

URL:

https://BASE_URL/api/VERSION/routes

Method: POST

Request content type: application/json

Parameters:

NameDescriptionTypeRequiredExample values
namethe name of the new routeStringYes 
referencethe reference of the new appointmentStringYes 
geographicLocationIdthe id of region which the route will be associatedLongNo 

geographicLocationId must be an ID of a leaf region located within the geographical positions’ hierarchical tree
reference must be unique

Success Output

Success case: response.status = 201
{
  "id": 2,
  "reference": "R-RT-001",
  "name": "fast and furious",
  "geographicLocation": {
    "id": 3,
    "name": "Nice",
    "href": "/api/v1.0/regions/3"
  },
  "organization": "entity1",
  "dateCreated": "2016-10-17T14:05:54Z",
  "lastUpdated": "2016-10-18T09:52:10Z"
}

Failure Output

Failure case:response.status = 400
{
  "error": "invalid_param_type",
  "error_description": "The type of parameter geographicLocationId you provided is not valid for this request."
}
{
  "error": "missing_param",
  "error_description": "name parameter is missing"
}
{
  "error": "not_unique",
  "error_description": "reference already used"
}
{
  "error": "save_failed",
  "error_description": "Failed to save instance"
}

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

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