Skip to main content
GET
/
v2
/
vrp
/
jobs
/
{id}
/
solution
Solution
curl --request GET \
  --url https://api.solvice.io/v2/vrp/jobs/{id}/solution \
  --header 'Authorization: <api-key>'
import requests

url = "https://api.solvice.io/v2/vrp/jobs/{id}/solution"

headers = {"Authorization": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: '<api-key>'}};

fetch('https://api.solvice.io/v2/vrp/jobs/{id}/solution', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.solvice.io/v2/vrp/jobs/{id}/solution",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "Authorization: <api-key>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.solvice.io/v2/vrp/jobs/{id}/solution"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "<api-key>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.solvice.io/v2/vrp/jobs/{id}/solution")
  .header("Authorization", "<api-key>")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://api.solvice.io/v2/vrp/jobs/{id}/solution")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "trips": [
    {
      "visits": [
        {
          "arrival": "2022-03-10T12:15:50-04:00",
          "serviceTime": 123,
          "travelTime": 123,
          "distance": 123,
          "job": "<string>",
          "activity": "<string>",
          "location": {
            "latitude": 123,
            "longitude": 123,
            "h3Index": 123
          },
          "latlon": [
            123
          ],
          "snappedLocation": {
            "latitude": 123,
            "longitude": 123,
            "h3Index": 123
          },
          "breakTime": 123,
          "waitTime": 123
        }
      ],
      "resource": "<string>",
      "date": "<string>",
      "departureTime": "<string>",
      "waitTime": 123,
      "travelTime": 123,
      "workTime": 123,
      "serviceTime": 123,
      "polyline": "<string>",
      "occupancy": 123,
      "start": {
        "job": "Job-1",
        "arrival": "2023-01-13T08:30:00Z",
        "serviceTime": 600,
        "travelTime": 1800,
        "distance": 15000,
        "activity": "service",
        "location": {
          "latitude": 51.0543,
          "longitude": 3.7174
        },
        "breakTime": 0,
        "waitTime": 0
      },
      "end": {
        "job": "Job-1",
        "arrival": "2023-01-13T08:30:00Z",
        "serviceTime": 600,
        "travelTime": 1800,
        "distance": 15000,
        "activity": "service",
        "location": {
          "latitude": 51.0543,
          "longitude": 3.7174
        },
        "breakTime": 0,
        "waitTime": 0
      },
      "distance": 123
    }
  ],
  "id": "<string>",
  "status": "SOLVED",
  "score": {
    "hardScore": 123,
    "mediumScore": 123,
    "softScore": 123,
    "feasible": true
  },
  "unresolved": "<unknown>",
  "totalWaitTimeInSeconds": 123,
  "occupancy": 123,
  "totalTravelDistanceInMeters": 123,
  "totalTravelTimeInSeconds": 123,
  "totalServiceTimeInSeconds": 123,
  "unserved": [
    "<string>"
  ],
  "unservedReasons": {},
  "suggestions": [
    {
      "score": {
        "hardScore": 123,
        "mediumScore": 123,
        "softScore": 123,
        "feasible": true
      },
      "assignments": [
        {
          "job": "<string>",
          "resource": "<string>",
          "executedAfter": "<string>",
          "suggestedArrival": "<string>",
          "latestArrival": "<string>",
          "score": {
            "hardScore": 123,
            "mediumScore": 123,
            "softScore": 123,
            "feasible": true
          },
          "scoreExplanation": {
            "score": "<string>"
          },
          "suggestedInitialArrival": "2022-03-10T12:15:50-04:00",
          "violations": [
            {
              "score": "<string>"
            }
          ]
        }
      ]
    }
  ],
  "messages": [
    "<string>"
  ],
  "estimatedCost": {
    "totalCostEur": 450.75,
    "travelTimeCostEur": 125.5,
    "distanceCostEur": 87.5,
    "waitTimeCostEur": 15,
    "laborCostEur": 200,
    "activationCostEur": 50,
    "penaltyCostEur": 27.25
  },
  "violations": [
    {
      "name": "<string>",
      "value": 123,
      "level": "[HARD, MEDIUM, SOFT]"
    }
  ],
  "workloadFairness": 123
}
{
  "message": "<string>"
}
{
  "message": "<string>"
}
{
  "message": "<string>"
}

Authorizations

Authorization
string
header
required

Api Key based authentication (apikey)

Path Parameters

id
string
required

Response

Status

OnRoute response from solve

trips
object[]
required

Actual solution: trips per shift/day and per resource

id
string | null

Id of the solve job

Example:

"0000-00000-00000-0000"

status
enum<string> | null

Status of the solve job.

Available options:
ERROR,
QUEUED,
SOLVING,
SOLVED
Example:

"SOLVED"

score
object | null

The score of a solution shows how good this solution is w.r.t all the constraints. All solvers try to maximize the score.

unresolved
any

Constraints that are violated

totalWaitTimeInSeconds
integer<int64> | null

Wait time for all resources

Example:

123

occupancy
number<double> | null

How full this schedule is in terms of work time (incl travel) over capacity. Eg 80%

Example:

0.8

totalTravelDistanceInMeters
integer<int64> | null

Travel distance for all resources in meters

Example:

123

totalTravelTimeInSeconds
integer<int64> | null

Travel time for all resources

Example:

123

totalServiceTimeInSeconds
integer<int64> | null

Service time for all resources

Example:

123

unserved
string[] | null

Unserved jobs

Example:

"[job-1]"

unservedReasons
object | null

Reasons why jobs could not be served, mapped by job name

Example:
{
  "job-1": [
    "DATE_TIME_WINDOW_CONFLICT",
    "TRIP_CAPACITY"
  ]
}
suggestions
object[] | null

List of suggested assignments returned by suggest api call

messages
string[] | null

Events and warnings generated during the solver execution

estimatedCost
object

Financial cost breakdown of the optimized solution. Only populated when costs configuration is provided in the request.

Example:
{
  "totalCostEur": 450.75,
  "travelTimeCostEur": 125.5,
  "distanceCostEur": 87.5,
  "waitTimeCostEur": 15,
  "laborCostEur": 200,
  "activationCostEur": 50,
  "penaltyCostEur": 27.25
}
violations
object[] | null
workloadFairness
number<double> | null