Get started

This section outlines how to quickly get started using the HERE Routing API on the HERE platform.

  1. Get a HERE account
  2. Create a project
  3. Get an API key
  4. Send a request

Note

This section provides information on the minimum setup required to quickly begin using the HERE Routing API. For more detailed information on HERE account setup, project creation, app registration, and authentication, see the Identity & Access Management Developer Guide.

Get a HERE Account

If your organization has signed up for HERE Workspace or HERE Marketplace, contact your organization admin who can invite you to join the HERE platform organization established for your company. You can also request a free trial of the HERE platform if your company does not have an organization established for it. For more information, see the HERE platform pricing.

Create a project

To create a project, follow these steps:

  1. Sign in to the HERE platform using your HERE account.
  2. Open the Projects Manager from the Launcher.
  3. Click Create new project.
  4. Enter a name for the project. Project names don't have to be unique.
  5. Enter a project ID. Project IDs must be unique within an organization and cannot be changed for the lifetime of the organization. Project IDs must be between 4 and 16 characters in length.
  6. Optional: Enter a description.
  7. Click Save.

Get an API key

To get an API key, follow these steps:

  1. On the Resources tab, select Services and then click Link a service.
  2. Search for the HERE Routing service and click Link.
  3. Optional: Search for additional services and click Link to link them to your project as needed.
  4. Click Done.
  5. Select the Access and permissions tab and click Grant access.
  6. Under New app, select Create.
  7. Provide an app name and click Register. The platform creates a new app with a unique app ID.
  8. On the Credentials tab, select API Keys and then click Create API key to generate a maximum of two API Keys for your application authentication credentials. The API key is created and displayed.

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 be bicycle, bus, car,pedestrian,scooter, taxi, or truck.

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&return=summary&apikey={YOUR_API_KEY}'

Note

This example uses an API key to authenticate your request. For the available authentication options, see the Identity & Access Management Guide.

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. Additional summary information, such as the length and duration are also provided.

{
  "routes": [
    {
      "id": "cc0441f1-b8ca-4410-95d5-bfd930053c03",
      "sections": [
        {
          "id": "256fef6e-6712-47fe-8e68-095c1204eb1a",
          "type": "vehicle",
          "departure": {
            "place": {
              "type": "place",
              "location": {
                "lat": 52.5309837,
                "lng": 13.384567
              },
              "originalLocation": {
                "lat": 52.5307999,
                "lng": 13.3847
              }
            }
          },
          "arrival": {
            "place": {
              "type": "place",
              "location": {
                "lat": 52.5263761,
                "lng": 13.3686186
              },
              "originalLocation": {
                "lat": 52.5263999,
                "lng": 13.3686
              }
            }
          },
          "summary": {
            "duration": 243,
            "length": 1206,
            "baseDuration": 136
          },
          "transport": {
            "mode": "car"
          }
        }
      ]
    }
  ]
}

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&apikey={YOUR_API_KEY}' \

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.",
      "code": "routeCalculationFailed"
    }
  ],
  "routes": []
}

Encoding your request

Some parameter values, especially waypoint specifications, use a structured string in their values. Content characters may then clash with control characters in your request. Consider for example a request such as the following:

https://router.hereapi.com/v8/routes?transportMode=car&origin=54.32556,14.65314&destination=54.65422,14.66636;nameHint=Fish & Chips! St. 25&apikey={YOUR_API_KEY}

Such a request is ambiguous due to the use of control characters (&, !) in the value of nameHint. Such characters need to be appropriately percent-encoded for disambiguation. The following guidelines apply for percent-encoding your requests:

  • Never percent encode & or = when they are used as control characters.
  • If your request does not use control characters as content (i.e., they are only used for their intended control meaning), you don't need to encode anything.
  • If your request does use control characters for content, percent-encode them, but leave the controlling characters unencoded. Do not double-encode. In such mixed requests, all naked control characters will be interpreted as control, and all encoded ones as content.

Therefore, the above request should be encoded as:

https://router.hereapi.com/v8/routes?transportMode=car&origin=53.32556,14.65314&destination=53.65422,14.66636;nameHint=Fish%20%26%20Chips%21%20St.%2025&apikey={YOUR_API_KEY}

Next steps

For a full list of available examples, see the tutorials in the table of contents of this guide. For the terms and conditions covering this documentation, see the HERE Documentation License. HERE is committed to respecting your privacy and to complying with applicable data protection and privacy laws. For more information, see the HERE Privacy Policy.

results matching ""

    No results matching ""