Endpoints#

Tarot Routing - Route Optimisation API

Synchronous Route Optimisation API#

POST /api/optimise#

A synchronous endpoint for all Route Optimisation requests

Request Headers
Request JSON Object
  • jobs – A list of Jobs to be considered in the optimisation

  • drivers – A list of Drivers available to serve those Jobs

  • settings – The Settings which govern this optimisation

Response JSON Object
  • runs – A list of optimised runs. The first item in each Run is the Driver. Subsequent items (if any) are the Jobs

  • unserved_jobs – A list jobs which the optimiser could not plan given the constraints and available Drivers

Status Codes
  • 200 OK – Optimised Successfully

  • 400 Bad Request – There was an issue with your request, please look at the message for details.

Example request:

Request Body ex1.json#
{
  "drivers": [
    {
      "uid": "drvid1",
      "shift_start": 8,
      "shift_end": 17,
      "location": {"lat": -33.867798, "lon": 151.166256}
    }
  ],
  "jobs": [
    {
      "uid": "uid1",
      "duration": 2,
      "location": {"lat": -33.849489, "lon": 151.127482}
    },
    {
      "uid": "uid2",
      "duration": 2,
      "location": {"lat": -33.880661, "lon": 151.183096}
    },
    {
      "uid": "uid3",
      "duration": 2,
      "location": {"lat": -33.913168, "lon": 151.262267}
    }
  ],
  "settings": {}
}
TOKEN={your_tarot_routing_token}
curl https://api.route.optimiser.app/api/optimise \
      -H "Authorization: Token $TOKEN" \
      -H "Content-Type: application/json" \
      --data "@ex1.json"

Example response:

HTTP/1.1 200 OK
Response Body#
{
    "runs": [
        [
            {
                "location": {
                    "lat": -33.86779863,
                    "lon": 151.1662566
                },
                "shift_start": 8.0,
                "shift_end": 17.0,
                "lunch_time": 11.25,
                "lunch_duration": 1.25,
                "capacity": null,
                "run": 1,
                "seq": 0,
                "uid": "drvid1"
            },
            {
                "location": {
                    "lat": -33.84948962,
                    "lon": 151.1274823
                },
                "duration": 2.0,
                "arrive_after": null,
                "leave_by": null,
                "size": null,
                "run": 1,
                "seq": 1,
                "eta": "08:14",
                "etd": "08:16",
                "decimal_eta": 8.25,
                "decimal_etd": 8.28,
                "uid": "uid1"
            },
            {
                "location": {
                    "lat": -33.91316848,
                    "lon": 151.2622676
                },
                "duration": 2.0,
                "arrive_after": null,
                "leave_by": null,
                "size": null,
                "run": 1,
                "seq": 2,
                "eta": "08:52",
                "etd": "08:54",
                "decimal_eta": 8.88,
                "decimal_etd": 8.91,
                "uid": "uid3"
            },
            {
                "location": {
                    "lat": -33.88066125,
                    "lon": 151.1830961
                },
                "duration": 2.0,
                "arrive_after": null,
                "leave_by": null,
                "size": null,
                "run": 1,
                "seq": 3,
                "eta": "09:19",
                "etd": "09:21",
                "decimal_eta": 9.32,
                "decimal_etd": 9.35,
                "uid": "uid2"
            }
        ]
    ],
    "unserved_jobs": [],
    "settings": {
        "single_run": false,
        "allocate_fairly": true,
        "runs_only": true,
        "lunch_duration": 1.25,
        "lunch_time": 11.25,
        "job_duration": 2.0,
        "verbose": false,
        "shift_end": 17,
        "shift_start": 8,
        "iterative": false,
        "single_day": true
    }
}

Asynchronous Route Optimisation API#

Coming soon.

Interested? Let us know info@tarotanalytics.com