Send a Request

Create a new problem solving request. If the request is valid, the service will start calculating and will return a solution once the calculation is completed. Example of a problem request:

POST https://vrp.api.here.com/v1/problems
Authorization: Bearer <TOKEN>
Content-Type: application/json

Body:

{
  "id": "myProblem",
  "plan": {
    "jobs": [
      {
        "id": "myJob",
        "places": {
          "delivery": {
            "location": {"lat": 52.46642, "lng": 13.28124},
            "times": [["2019-07-04T10:00:00.000Z","2019-07-04T12:00:00.000Z"]],
            "duration": 180
          }
        },
        "demand": [1]
      }
    ]
  },
  "fleet": {
    "types": [
      {
        "id": "myVehicle",
        "profile": "car",
        "costs": {
          "distance": 0.0002,
          "time": 0.004806,
          "fixed": 22
        },
        "shifts": [{
          "start": {
            "time": "2019-07-04T09:00:00Z",
            "location": {"lat": 52.52568, "lng": 13.45345}
          },
          "end": {
            "time": "2019-07-04T18:00:00Z",
            "location": {"lat": 52.52568, "lng": 13.45345}
          }
        }],
        "capacity": [10],
        "amount": 1
      }
    ],
    "profiles": [{
      "name": "normal_car",
      "type": "car"
     }]
  }
}

Example of a response with a calculated solution:

{
  "problemId": "myProblem",
  "statistic": {
    "cost": 54.459916,
    "distance": 35277,
    "duration": 5286,
    "times": {
      "driving": 5106,
      "serving": 180,
      "waiting": 0,
      "break": 0
    }
  },
  "tours": [
    {
      "vehicleId": "myVehicle_1",
      "typeId": "myVehicle",
      "stops": [
        {
          "location": {"lat": 52.52568, "lng": 13.45345},
          "time": {
            "arrival": "2019-07-04T09:19:01Z",
            "departure": "2019-07-04T09:19:01Z"
          },
          "load": [1],
          "activities": [
            {
              "jobId": "departure",
              "type": "departure"
            }
          ]
        },
        {
          "location": {"lat": 52.46642, "lng": 13.28124},
          "time": {
            "arrival": "2019-07-04T10:00:00Z",
            "departure": "2019-07-04T10:03:00Z"
          },
          "load": [0],
          "activities": [
            {
              "jobId": "myJob",
              "type": "delivery"
            }
          ]
        },
        {
          "location": {"lat": 52.52568, "lng": 13.45345},
          "time": {
            "arrival": "2019-07-04T10:47:07Z",
            "departure": "2019-07-04T10:47:07Z"
          },
          "load": [0],
          "activities": [
            {
              "jobId": "arrival",
              "type": "arrival"
            }
          ]
        }
      ],
      "statistic": {
        "cost": 54.459916,
        "distance": 35277,
        "duration": 5286,
        "times": {
          "driving": 5106,
          "serving": 180,
          "waiting": 0,
          "break": 0
        }
      }
    }
  ]
}

See solution topic for a detailed explanation.

If a request is not valid, then the corresponding error is returned. Example of a validation error:

{
  "title": "BAD_REQUEST",
  "status": 400,
  "code": "E900420",
  "cause": "Vehicle's arrival time is earlier than its departure time",
  "action": "Correct arrival time of 'vehicle' to be earlier than its departure",
  "correlationId": "fee3c453-f537-49ca-a285-f5f076bce7d1"
}

results matching ""

    No results matching ""