GuidesAPI Reference
Guides

How to obtain traffic info and rest time constraints

A dispatcher needs to find the fastest way to travel by truck from Paris to Vienna, Milan, and Rome before returning to Paris. The dispatcher wants to know traffic information and include rest times in the total time.

Request

curl -H "Authorization: Bearer BEARER_TOKEN" "https://wps.hereapi.com/v8/findsequence2?mode=fastest;truck;traffic:enabled;&start=Paris1%3B48.851628%2C2.345975&departure=2015-08-17T07:30:00%2b01:00&end=Paris2%3B48.853237%2C2.370351&destination1=Vienna%3B48.188456%2C16.365020;st:1800&destination2=Rome%3B41.844794%2C12.411838;st:1800&destination3=Milan;45.468069,9.157236&restTimes=durations:16200,2700,32400,39600;serviceTimes:work"

Response

{
  "results": [
    {
      "waypoints": [
        {
          "id": "Paris1",
          "lat": 48.851628,
          "lng": 2.345975,
          "sequence": 0,
          "estimatedArrival": null,
          "estimatedDeparture": "2015-08-17T07:30:00+01:00",
          "fulfilledConstraints": []
        },
        {
          "id": "Milan",
          "lat": 45.468069,
          "lng": 9.157236,
          "sequence": 1,
          "estimatedArrival": "2015-08-18T05:14:31+01:00",
          "estimatedDeparture": "2015-08-18T05:14:31+01:00",
          "fulfilledConstraints": []
        },
        {
          "id": "Rome",
          "lat": 41.844794,
          "lng": 12.411838,
          "sequence": 2,
          "estimatedArrival": "2015-08-18T12:54:05+01:00",
          "estimatedDeparture": "2015-08-18T13:24:05+01:00",
          "fulfilledConstraints": [
            "st:1800"
          ]
        },
        {
          "id": "Vienna",
          "lat": 48.188456,
          "lng": 16.36502,
          "sequence": 3,
          "estimatedArrival": "2015-08-20T01:42:19+01:00",
          "estimatedDeparture": "2015-08-20T02:12:19+01:00",
          "fulfilledConstraints": [
            "st:1800"
          ]
        },
        {
          "id": "Paris2",
          "lat": 48.853237,
          "lng": 2.370351,
          "sequence": 4,
          "estimatedArrival": "2015-08-21T17:00:41+01:00",
          "estimatedDeparture": null,
          "fulfilledConstraints": []
        }
      ],
      "distance": "3792620",
      "time": "379841",
      "interconnections": [
        {
          "fromWaypoint": "Paris1",
          "toWaypoint": "Milan",
          "distance": 849648,
          "time": 35971,
          "rest": 42300,
          "waiting": 0
        },
        {
          "fromWaypoint": "Milan",
          "toWaypoint": "Rome",
          "distance": 596128,
          "time": 24874,
          "rest": 2700,
          "waiting": 0
        },
        {
          "fromWaypoint": "Rome",
          "toWaypoint": "Vienna",
          "distance": 1106421,
          "time": 48794,
          "rest": 81900,
          "waiting": 0
        },
        {
          "fromWaypoint": "Vienna",
          "toWaypoint": "Paris2",
          "distance": 1240423,
          "time": 55102,
          "rest": 84600,
          "waiting": 0
        }
      ],
      "description": "Targeted best time; with , improvement for traffic",
      "timeBreakdown": {
        "driving": 164741,
        "service": 3600,
        "rest": 211500,
        "waiting": 0,
        "break": 0
      }
    }
  ],
  "errors": [],
  "processingTimeDesc": "2651ms",
  "responseCode": "200",
  "warnings": null,
  "requestId": "cdb5abf4-d069-443d-a040-1d47c8ddc959"
}