Fleet routing API

POST /v1/fleet

Fleet routing API computes routes for vehicles with them overall visiting all provided locations and being most efficient. Full URL for requests is https://api.strues-maps.lt/v1/fleet. Only successful requests are counted towards hard limits and are billed.

Request parameters

api_key=your_personal_api_key

Api key is provided after registration. Api key is used for service configuration like hard limits and billing.

signature=your_personal_signature

Signature which must be used with api key is provided after registration.

Request payload

Request payload must be a valid JSON object. Request must have a header Content-Type set to application/json.

{
    "vehicles": [
        {
            "id": 1,
            "description": "Description for vehicle",
            "start": [long, lat],
            "end": [long, lat]
        }
    ],
    "jobs": [
        {
            "id": 1,
            "description": "Description for job",
            "location": [long, lat],
            "setup": 0,
            "service": 0
        }
    ]
}

vehicles[i].id

Vehicle id in caller information system.

vehicles[i].description

Vehicle description in caller information system.

vehicles[i].start[0]

Longitude of vehicle start position. Longitude must be supplied in WGS84 projection, also known as EPSG 4326.

vehicles[i].start[1]

Latitude of vehicle start position. Latitude must be supplied in WGS84 projection, also known as EPSG 4326.

vehicles[i].end[0]

Longitude of vehicle end position. Longitude must be supplied in WGS84 projection, also known as EPSG 4326.

vehicles[i].end[1]

Latitude of vehicle end position. Latitude must be supplied in WGS84 projection, also known as EPSG 4326.

jobs[j].id

Job id in caller information system.

jobs[j].description

Job description in caller information system.

jobs[j].location[0]

Longitude of location to be visited. Longitude must be supplied in WGS84 projection, also known as EPSG 4326.

jobs[j].location[1]

Latitude of location to be visited. Latitude must be supplied in WGS84 projection, also known as EPSG 4326.

jobs[j].setup

Job setup duration in seconds.

jobs[j].service

Job service duration in seconds.

Response codes

200 - Successful response

Request was successfully. Response body contains routes for vehicles.

400 - Bad request exception

Returned if parameters are not provided or provided in an invalid format.

401 - Unauthorized

Returned if api key or signature is invalid.

429 - Too many requests

Returned if hard limits are reached.

402 - Payment required

Returned if user has insufficient funds to make a request.

500 - Internal server error

Returned if unexpected error has occurred. We are working on it to resolve it.

Response body

{
    "code": "Ok",
    "summary": {
        "cost": 11956,
        "unassigned": 0,
        "service": 0,
        "duration": 11956,
        "waiting_time": 0,
        "priority": 0,
        "distance": 242892,
    }
    "unassigned": [],
    "routes": [
        {
            "vehicle": 1,
            "cost": 11956,
            "service": 0,
            "duration": 11956,
            "waiting_time": 0,
            "priority": 0,
            "distance": 242892,
            "steps": [
                {
                    "type": "start",
                    "location": [
                        23.856908006503083,
                        54.956761105317305
                    ],
                    "service": 0,
                    "waiting_time": 0,
                    "arrival": 0,
                    "duration": 0,
                    "violations": [],
                    "distance": 0
                },
                {
                    "type": "job",
                    "description": "Job description",
                    "location": [
                        22.8298085733155,
                        55.39890896128309
                    ],
                    "id": 1,
                    "service": 0,
                    "waiting_time": 0,
                    "job": 1,
                    "arrival": 8512,
                    "duration": 8512,
                    "violations": [],
                    "distance": 152591
                },
                {
                    "type": "end",
                    "location": [
                        23.856908006503083,
                        54.956761105317305
                    ],
                    "service": 0,
                    "waiting_time": 0,
                    "arrival": 11956,
                    "duration": 11956,
                    "violations": [],
                    "distance": 242892
                }
            ],
            "violations": [],
            "geometry": "wrlnIoyrpC..."
        }
    ]
}

code - "Ok", "InternalError", "InvalidQuery" or "RoutingError"

summary.cost - cost of vehicle routes in seconds.

summary.unassigned - number of unassigned destinations.

summary.service - total service time for all routes.

summary.duration - duration of vehicle routes in seconds.

summary.waiting_time - total waiting time for all routes.

summary.distance - total distance for all routes in meters.

routes[i].vehicle - vehicle id of ith route.

routes[i].cost - cost of vehicle route in seconds.

routes[i].service - total service time for this route.

routes[i].duration - total duration time for this route.

routes[i].distance - total distance for this route in meters.

routes[i].geometry - polyline encoded route geometry in WSG84 projection, also known as EPSG 4326.

routes[i].steps[j].type - "start", "job" or "end".

routes[i].steps[j].id - id of job performed at this step.

routes[i].steps[j].description - step description if provided in input.

routes[i].steps[j].location[0] - longitude of location to be visited. Longitude is in WGS84 projection, also known as EPSG 4326.

routes[i].steps[j].location[1] - latitude of location to be visited. Latitude is in WGS84 projection, also known as EPSG 4326.

routes[i].steps[j].service - service time of this step in seconds.

routes[i].steps[j].arrival - estimated time of arrival at this step.

routes[i].steps[j].duration - cumulated travel time upon arrival at this step.

routes[i].steps[j].distance - traveled distance upon arrival at this step.