Send a Request

A route calculation consists of a single GET request. The only required parameters are an origin and a destination, given by two pairs of WGS84 coordinates in the form <latitude>,<longitude>; and a transportation mode, which can currently be any of car, truck, or pedestrian. The following request will calculate a car route with default options:

curl -X GET \
    'https://router.hereapi.com/v8/routes?transportMode=car&origin=52.5308,13.3847&destination=52.5264,13.3686'

Note

Depending on your authentication method you either need to add an Authorization header with a Bearer token or a query parameter to the example requests shown here. See Authentication for details.

Note

Postman users can import these examples: Import > Paste Raw Text

If the route calculation was successful, the response contains the calculated route with departure and arrival times in one or more sections:

{
    "routes": [
        {
            "id": "7bd397be-5f88-47a5-97dc-f8a798bedab5",
            "sections": [
                {
                    "arrival": {
                        "place": {
                            "location": {
                                "lat": 52.52637614496052,
                                "lng": 13.368618562817574
                            },
                            "type": "place"
                        },
                        "time": "2019-12-09T10:41:28+01:00"
                    },
                    "departure": {
                        "place": {
                            "location": {
                                "lat": 52.53098367713392,
                                "lng": 13.384566977620125
                            },
                            "type": "place"
                        },
                        "time": "2019-12-09T10:37:51+01:00"
                    },
                    "id": "2ffcc2d2-c859-4417-85b0-6a90b36df2b9",
                    "transport": {
                        "mode": "car"
                    },
                    "type": "vehicle"
                }
            ]
        }
    ]
}

No Routes Possible

Some requests will not result in any routes for a number of reasons. This example requests a route from the HERE Berlin office to the HERE Chicago office:

curl -X GET \
  'https://router.hereapi.com/v8/routes?transportMode=car&origin=52.5308,13.3847&destination=41.8845,-87.6386' \

Of course, the Atlantic Ocean is between these two offices. This causes the route calculation to fail with the following response:

{
  "notice": [
    {
      "title": "Route calculation failed: Couldn't find a route. Graph disconnected?",
      "code": "E602203"
    }
  ],
  "routes": []
}

results matching ""

    No results matching ""