https://api.routific.com/v1/vrp-long
The vrp-long
and pdp-long
endpoints will trigger a long-running background task on our servers, while we give you a URL to ping to fetch the results. This is necessary for larger requests that take longer than 20 seconds. Here are some processing times to give you a rough idea:
Number of visits | Processing time |
---|---|
< 30 | < 2s |
50 | 8s |
100 | 35s |
500 | 280s |
1000 | 600s |
Processing times may vary
Keep in mind that the above processing times are averages; exact processing times may vary greatly, depending on the fleet size, as well as number of constraints.
When you POST to the above URL, it will return immediately with a 202
HTTP code and a job_id
:
{ "job_id": "[someID]" }
With this job_id
you can query the status with a GET request to the following URL:
https://api.routific.com/jobs/[someID]
When the job is still busy, the status will be pending
or processing
. Once it is finished, the status is finished
. The response that you would normally get directly from the synchronous endpoint, is now in output
.
If there was an error during processing, the status will be error
and the error message will be a string in the output
.
{
"visits": {
"order_1": {
"location": {
"name": "6800 Cambie",
"lat": 49.227107,
"lng": -123.1163085
}
},
"order_2": {
"location": {
"name": "3780 Arbutus",
"lat": 49.2474624,
"lng": -123.1532338
}
},
"order_3": {
"location": {
"name": "800 Robson",
"lat": 49.2819229,
"lng": -123.1211844
}
}
},
"fleet": {
"vehicle_1": {
"start_location": {
"id": "depot",
"name": "800 Kingsway",
"lat": 49.2553636,
"lng": -123.0873365
}
}
}
}
{ "job_id": "[someID]" }
{
"status": "pending",
"input": { ... },
"id": "[someID]",
"started_at": [timestamp]
}
{
"status": "finished",
"output": {
"status": "success",
"fitness": 31,
"unserved:": null,
"solution": { ... }
},
"id": "[someID]",
"started_at": [timestamp],
"finished_at": [timestamp],
"input": { ... }
}
{
"status": "error",
"input": { ... },
"id": "[someID]",
"started_at": [timestamp],
"output": "Sorry - we couldn't find a route for you today. Can you check your driver/stop inputs?"
}