Insert Jobs
POSThttps://routecloud.telogis.com/v1/insert.- Authentication required.
- Request body: insert_request.
- Response body: If
wait=1specified, returns the task result (see below). Otherwise, returns a task_redirect_response. - Task result: If return_request is
true, returns a problem. Otherwise, returns an insert_response.
The insert jobs operation inserts a list of jobs into routes without changing the sequencing of the existing jobs.
Query Parameters
wait=1- Optional. Wait until theinsertcompletes before returning the result. See Retrieving API Results.
Status Codes
200- Success.302- Ifwait=1was provided and theinsertresult is not yet available, a redirect is sent instead of a normal result every 15 seconds to refresh the HTTP timeout. See Retrieving API Results.400- The input problem is invalid. The response is an error_response.401- Authentication required.429- Exceeded usage limits.
insert_request
The insert_request type inherits all fields from problem.
| Name | Type | Description |
|---|---|---|
| allow_hard_constraint_violations | boolean | Defines if hard constraints should be ignored when inserting jobs. Defaults to false. |
| custom | custom | Inherited. User-supplied custom fields that are returned unmodified in the response. These have no effect on optimization. |
| drivers | driver[] | Inherited. If specified, the drivers involved in this request. |
| id | string | Inherited. An identifier for the request. See Request IDs. |
| jobs_to_insert | job[] | The jobs to be inserted. |
| markers | *marker[] | Inherited*. The markers involved in this request. If defined here, markers can be referenced by id elsewhere; for example, job.location. |
| name | string | Inherited. A name for the request. See Request IDs. |
| return_request | boolean | Defines if the original request, with calculated values, is returned as the response. If not, an Insert Response is returned. See Full vs Partial Responses. Defaults to false. |
| routes | route[] | Inherited. Routes to insert the jobs into. |
| schedules | schedule[] | Inherited. If specified, applies recurring schedule constraints to the jobs. |
| settings | settings | Inherited. Settings to apply during the insert call. |
| vehicles | vehicle[] | The vehicles involved in this optimization problem. If defined here, vehicles can be referenced by id elsewhere; for example, route.vehicle. |
{
"id": "request+1234567",
"name": "territory1",
"routes": [
{
"id": "route0",
"location": "39.718005, -104.969531",
"start_time": "09:00",
"jobs": [
{ "id": "job0", "time_on_site": "00:15", "location": "39.590789, -105.084376" },
{ "id": "job1", "time_on_site": "00:10", "location": "39.597111, -105.041015" }
]
}, {
"id": "route1",
"location": "39.718005, -104.969531",
"start_time": "09:00",
"jobs": [
{ "id": "job2", "time_on_site": "00:10", "location": "39.749546, -105.069141" },
{ "id": "job3", "time_on_site": "00:10", "location": "39.727919, -105.103126" }
]
}
],
"jobs_to_insert": [
{ "id": "job_to_insert1", "time_on_site": "00:10", "location": "39.820688, -105.133594" },
{ "id": "job_to_insert2", "time_on_site": "00:15", "location": "39.825626, -105.130460" },
{ "id": "job_to_insert3", "location": "39.825626, -105.130460", "required_route_attributes": ["unsatisfiable"] }
],
"allow_hard_constraint_violations": false
}
An example insert request.
insert_response
Note
The result of an insert is a problem instead of an insert_response, if return_request was set to true on the input.
The insert_response type inherits all fields from problem_response.
| Name | Type | Description |
|---|---|---|
| custom | custom | Inherited. User-supplied custom fields that were sent in the request. |
| routes | route_response[] | Inherited. Routes with jobs inserted. |
| schedules | schedule_response[] | Inherited. Schedules that had their base dates assigned, if any. See Routing with Schedules. |
| unrouted_jobs | stop_response[] | Inherited. Jobs that could not be routed. |
{
"routes": [
{
"id": "route0", ...
"stops": [
{ "type": "depot", ... },
{ "id": "job0", ... },
{ "id": "job1", ... },
{ "type": "depot", ... }
]
},
{
"id": "route1",
"stops": [
{ "type": "depot", ... },
{ "id": "job2", ... },
{ "id": "job_to_insert1", ... },
{ "id": "job_to_insert2", ... },
{ "id": "job3", ... },
{ "type": "depot", ... }
]
}
],
"unrouted_jobs": [
{ "id": "job_to_insert3" }
]
}
An example insert response.