### GET /routes - Example with Passthrough Waypoint Source: https://www.here.com/docs/bundle/routing-api-developer-guide-v8/page/tutorials/passthrough-waypoint.html This example demonstrates how to make a GET request to the /routes endpoint with a via waypoint configured to pass through. This is useful for shaping routes and avoiding unnecessary detours or U-turns. ```APIDOC ## GET /routes ### Description Calculates a route between an origin and a destination, optionally including via waypoints. This specific example utilizes the `passThrough=true` parameter for a via waypoint to influence the route shape. ### Method GET ### Endpoint `https://router.hereapi.com/v8/routes` ### Query Parameters - **transportMode** (string) - Required - Specifies the mode of transport (e.g., 'car'). - **return** (string) - Optional - Specifies the data to be returned in the response (e.g., 'polyline', 'summary', 'passthrough'). - **origin** (string) - Required - The starting point of the route (latitude,longitude). - **destination** (string) - Required - The ending point of the route (latitude,longitude). - **via** (string) - Optional - An intermediate waypoint. Can include parameters like `!passThrough=true`. - **apiKey** (string) - Required - Your HERE API key. ### Request Example ```curl curl -gX GET 'https://router.hereapi.com/v8/routes?transportMode=car&return=polyline,summary,passthrough&origin=52.51375,13.42462&destination=52.52332,13.42800&via=52.52426,13.43000!passThrough=true&apiKey=YOUR_API_KEY' ``` ### Response #### Success Response (200) - **routes** (array) - Contains route information. - **id** (string) - Unique identifier for the route. - **sections** (array) - Contains route sections. - **summary** (object) - Summary of the section. - **duration** (number) - Estimated duration in seconds. - **length** (number) - Total length in meters. - **baseDuration** (number) - Base duration without traffic in seconds. - **passthrough** (array) - Information about passthrough waypoints. - **place** (object) - Details about the waypoint location. - **type** (string) - Type of place (e.g., 'place'). - **location** (object) - Geographic coordinates. - **lat** (number) - Latitude. - **lng** (number) - Longitude. - **originalLocation** (object) - The originally provided location for the waypoint. - **lat** (number) - Latitude. - **lng** (number) - Longitude. - **waypoint** (integer) - Index of the waypoint. - **offset** (number) - Offset along the route polyline where the waypoint is encountered. - **polyline** (string) - Encoded polyline representing the route geometry. - **transport** (object) - Transport mode details. - **mode** (string) - The mode of transport used. #### Response Example ```json { "routes": [ { "id": "338a34f2-60c2-4ced-b9c4-074c3c2f8039", "sections": [ { "summary": { "duration": 256, "length": 1970, "baseDuration": 256 }, "passthrough": [ { "place": { "type": "place", "location": { "lat": 52.5242323, "lng": 13.4301462 }, "originalLocation": { "lat": 52.52426, "lng": 13.43 }, "waypoint": 0 }, "offset": 49 } ], "polyline": "...", "transport": { "mode": "car" } } ] } ] } ``` ``` -------------------------------- ### GET /v8/routes - Example with URL Encoding Source: https://www.here.com/docs/bundle/routing-api-developer-guide-v8/page/concepts/request-encoding.html This example demonstrates how to make a GET request to the /v8/routes endpoint, showing the correct URL encoding for parameters containing special characters. ```APIDOC ## GET /v8/routes ### Description Retrieves routing information between specified origin and destination points. This example highlights the necessity of URL encoding for parameters containing special characters, such as the `nameHint` in the `destination` parameter. ### Method GET ### Endpoint `https://router.hereapi.com/v8/routes` ### Parameters #### Query Parameters - **transportMode** (string) - Required - Specifies the mode of transport (e.g., 'car'). - **origin** (string) - Required - The starting point for the route (latitude,longitude). - **destination** (string) - Required - The ending point for the route. Can include additional information like `nameHint`. Example: `latitude,longitude;nameHint=Encoded Name`. - **apiKey** (string) - Required - Your HERE API key for authentication. ### Request Example ```curl curl -gX GET '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' ``` ### Response #### Success Response (200) - **routes** (array) - Contains a list of calculated routes. - **route** (object) - Represents a single route. - **sections** (array) - Contains route sections. - **section** (object) - Represents a single section of the route. - **arrival** (object) - Arrival information for the section. - **time** (string) - Estimated arrival time. - **departure** (object) - Departure information for the section. - **time** (string) - Estimated departure time. - **travel** (object) - Travel information for the section. - **duration** (string) - Duration of the travel. - **length** (string) - Length of the travel. #### Response Example ```json { "routes": [ { "route": { "sections": [ { "section": { "arrival": { "time": "2024-01-01T10:00:00Z" }, "departure": { "time": "2024-01-01T09:00:00Z" }, "travel": { "duration": "PT1H", "length": "10000" } } } ] } } ] } ``` ### Important Notes on URL Encoding - **Reserved Characters**: Characters like `!`, `&`, `=`, `?`, `/`, `#`, `+`, `%`, and spaces have special meanings in URLs. When these characters appear as part of the *content* of a parameter value (e.g., in `nameHint`), they must be percent-encoded. - **Control Characters**: Characters like `&` and `=` are used as control characters to separate query parameters. Do not encode these when they serve their control function. - **Encoding Rules**: - Encode reserved characters that are part of the content. - Leave control characters unencoded. - Avoid double-encoding. - **Example**: In the `destination` parameter, `Fish Chips! St. 25` becomes `Fish%20%26%20Chips%21%20St.%2025` where spaces are `%20`, `&` is `%26`, and `!` is `%21`. ``` -------------------------------- ### GET /v8/routes - Vehicle Towing Example Source: https://www.here.com/docs/bundle/routing-api-developer-guide-v8/page/tutorials/route-with-vehicle-parameters.html This example shows how to calculate a route considering vehicle length, current weight, and trailer count for towing scenarios. ```APIDOC ## GET /v8/routes ### Description Calculates a route for a vehicle with specified length, weight, and trailer count, returning the polyline and summary. ### Method GET ### Endpoint https://router.hereapi.com/v8/routes ### Query Parameters - **origin** (string) - Required - The starting point for the route (latitude,longitude). - **destination** (string) - Required - The ending point for the route (latitude,longitude). - **return** (string) - Optional - Specifies the data to be returned (e.g., 'polyline', 'summary'). - **transportMode** (string) - Optional - The mode of transport (e.g., 'car'). - **vehicle[currentWeight]** (number) - Optional - The current weight of the vehicle in kilograms. - **vehicle[length]** (number) - Optional - The length of the vehicle in centimeters. - **vehicle[trailerCount]** (number) - Optional - The number of trailers attached to the vehicle. - **apiKey** (string) - Required - Your HERE API key. ### Request Example (with trailer) ```curl curl -gX GET 'https://router.hereapi.com/v8/routes?'\ 'origin=41.8669074,14.0680527&'\ 'destination=41.8733632,14.0690313&'\ 'return=polyline,summary&'\ 'transportMode=car&'\ 'vehicle[currentWeight]=3500&'\ 'vehicle[length]=700&'\ 'vehicle[trailerCount]=1&'\ 'apiKey=YOUR_API_KEY' ``` ### Request Example (without trailer) ```curl curl -gX GET 'https://router.hereapi.com/v8/routes?'\ 'origin=41.8669074,14.0680527&'\ 'destination=41.8733632,14.0690313&'\ 'return=polyline,summary&'\ 'transportMode=car&'\ 'vehicle[currentWeight]=2000&'\ 'vehicle[length]=400&'\ 'vehicle[trailerCount]=0&'\ 'apiKey=YOUR_API_KEY' ``` ### Response #### Success Response (200) - **polyline** (string) - The encoded polyline of the route. - **summary** (object) - A summary of the route, including duration, distance, and traffic information. #### Response Example ```json { "routes": [ { "boundingBox": { "northEast": {"lat": 41.8739899, "lng": 14.0694489}, "southWest": {"lat": 41.8663074, "lng": 14.0676357} }, "language": "en-US", "duration": 120, "distance": 750, "summary": { "text": "Route summary details.", "duration": 120, "distance": 750, "trafficLevel": "low", "trafficFlow": "moderate" }, "sections": [ { "type": "section", "departureTime": "2023-10-27T10:00:00Z", "arrivalTime": "2023-10-27T10:02:00Z", "duration": 120, "distance": 750, "trafficDelay": 0, "baseDuration": 120, "actions": [], "spans": [] } ], "polyline": "...encoded polyline..." } ] } ``` ``` -------------------------------- ### HERE Routing API v8 - Overview Source: https://www.here.com/docs/bundle/routing-api-developer-guide-v8/page/tutorials/calculate-route-with-charging.html This section provides an introduction to the HERE Routing API v8 and how to get started. ```APIDOC ## Introduction to HERE Routing API v8 This document outlines the capabilities and usage of the HERE Routing API v8, a powerful tool for calculating optimal routes based on various parameters. ### Get started with HERE Routing API v8 This section guides users through the initial steps of integrating and using the HERE Routing API v8, including setup and basic examples. ``` -------------------------------- ### GET /routes/{ROUTE_HANDLE} - Route Calculation Failed Example Source: https://www.here.com/docs/bundle/routing-api-developer-guide-v8/page/tutorials/adjust-route-after-deviation.html This example shows a response when route calculation fails, specifically when the origin cannot be matched. ```APIDOC ## GET /routes/{ROUTE_HANDLE} - Route Calculation Failed ### Description This example illustrates a typical response when the HERE Routing API fails to calculate a route, in this case, due to an inability to match the provided origin coordinates to the map data. ### Method GET ### Endpoint `https://router.hereapi.com/v8/routes/{ROUTE_HANDLE}` ### Path Parameters - **ROUTE_HANDLE** (string) - Required - The handle of the previously calculated route (may be irrelevant if calculation fails from the start). ### Query Parameters - **origin** (string) - Required - The starting point of the route, which could not be matched. - **return** (string) - Optional - Specifies the data to be returned. - **transportMode** (string) - Optional - The mode of transport. - **apiKey** (string) - Required - Your HERE API key. ### Request Example ``` curl -gX GET 'https://router.hereapi.com/v8/routes/{ROUTE_HANDLE}?'\ 'origin=52.532772,13.405133;course=100;minCourseDistance=50&'\ 'return=polyline&'\ 'transportMode=car&'\ 'apiKey=YOUR_API_KEY' ``` ### Response #### Error Response (Typically 4xx or 5xx, but may return 200 with notices) - **notices** (array) - An array of notices detailing the error. - **title** (string) - A human-readable description of the error. - **code** (string) - An error code (e.g., `couldNotMatchOrigin`). - **severity** (string) - The severity of the notice (e.g., `critical`). - **routes** (array) - An empty array, as no routes could be calculated. #### Response Example ```json { "notices": [ { "title": "Route calculation failed: Couldn't match origin.", "code": "couldNotMatchOrigin", "severity": "critical" } ], "routes": [] } ``` ``` -------------------------------- ### POST /routes - Initial Route with Weight Changes Source: https://www.here.com/docs/bundle/routing-api-developer-guide-v8/page/tutorials/waypoints-weight-change.html This example demonstrates how to request a route with specified weight changes at intermediate waypoints. The `via` parameter is used with the `currentWeightChange` modifier to indicate how the vehicle's weight changes upon reaching that waypoint. This is useful for scenarios like cargo pickup or drop-off. ```APIDOC ## POST /routes ### Description Calculates a route considering dynamic weight changes at specified waypoints. ### Method GET ### Endpoint `https://router.hereapi.com/v8/routes` ### Query Parameters - **origin** (string) - Required - The starting point of the route (latitude,longitude). - **destination** (string) - Required - The ending point of the route (latitude,longitude). - **via** (string) - Optional - Intermediate waypoints. Can include `!currentWeightChange=<+/-value>` to modify vehicle weight. - **return** (string) - Optional - Specifies the data to be returned (e.g., `summary`, `routeHandle`). - **transportMode** (string) - Optional - The mode of transport (e.g., `truck`). - **vehicle[grossWeight]** (number) - Optional - The maximum gross weight of the vehicle. - **vehicle[currentWeight]** (number) - Optional - The current weight of the vehicle. - **apiKey** (string) - Required - Your HERE API key. ### Request Example ```json { "code": "curl -gX GET 'https://router.hereapi.com/v8/routes?'\ 'origin=52.535153,13.269925&'\ 'destination=52.535153,13.269925&'\ 'via=52.529435,13.297411!currentWeightChange=+3000&'\ 'via=52.517161,13.317204!currentWeightChange=-4000&'\ 'return=summary,routeHandle&'\ 'transportMode=truck&'\ 'vehicle[grossWeight]=10000&'\ 'vehicle[currentWeight]=5000&'\ 'apiKey=YOUR_API_KEY'" } ``` ### Response #### Success Response (200) - **routes** (array) - An array of route objects. - **sections** (array) - An array of route section objects. - **transport** (object) - Transport details for the section. - **currentWeight** (number) - The current weight of the vehicle during this section. #### Response Example ```json { "routes": [ { "id": "36110c03-3b74-4698-bcec-0b75edf865b1", "sections": [ { "id": "29598024-11ba-44ec-9428-0fe7e72f06fd", "type": "vehicle", "departure": { "time": "2025-10-29T11:10:46+01:00", "place": { "type": "place", "location": {"lat": 52.5351699, "lng": 13.26993}, ... } }, "arrival": { "time": "2025-10-29T11:19:52+01:00", "place": { "type": "place", "location": {"lat": 52.5294482, "lng": 13.2974065}, ... } }, "summary": {"duration": 546, "length": 2514, "baseDuration": 278}, "transport": {"mode": "truck", "currentWeight": 5000} }, { "id": "b774ed30-c109-44c9-8d9d-134e9e0297f9", "type": "vehicle", ... "transport": {"mode": "truck", "currentWeight": 8000} }, { "id": "98a2d99d-e09a-44c0-8508-fe5ea8323109", "type": "vehicle", ... "transport": {"mode": "truck", "currentWeight": 4000} } ] } ] } ``` ``` -------------------------------- ### Avoid Segment in a Specific Direction (GET) Source: https://www.here.com/docs/bundle/routing-api-developer-guide-v8/page/tutorials/avoid-segments.html This example demonstrates how to avoid a specific map segment in a particular direction using a GET request. The segment ID is appended with '#-' to indicate avoidance in the negative direction. ```APIDOC ## GET /v8/routes ### Description Avoids a specific map segment in the negative direction (e.g., east to west). ### Method GET ### Endpoint `https://router.hereapi.com/v8/routes` ### Query Parameters - **origin** (string) - Required - The starting point for the route. - **destination** (string) - Required - The ending point for the route. - **avoid[segments]** (string) - Required - The segment to avoid, formatted as `segment_id#-` for negative direction. - **return** (string) - Optional - Specifies the data to be returned (e.g., `polyline`). - **spans** (string) - Optional - Specifies the spans to be returned (e.g., `segmentRef`). - **transportMode** (string) - Optional - The mode of transport (e.g., `car`). - **departureTime** (string) - Optional - The desired departure time. - **apiKey** (string) - Required - Your HERE API key. ### Request Example ``` curl -gX GET 'https://router.hereapi.com/v8/routes?'\ 'origin=45.485299,9.232146&'\ 'destination=45.484785,9.229564&'\ 'avoid[segments]=here:cm:segment:95058600%23-&'\ 'return=polyline&'\ 'spans=segmentRef&'\ 'transportMode=car&'\ 'departureTime=any&'\ 'apiKey=YOUR_API_KEY' ``` ### Response #### Success Response (200) - **routes** (array) - Contains route information. - **sections** (array) - Contains section information. - **spans** (array) - Contains span information, including segment references. #### Response Example ```json { "routes": [ { "sections": [ { "spans": [ { "startOffset": 0, "endOffset": 100, "length": 69.72647, "duration": 10, "roadName": "Example Road", "segmentRef": "here:cm:segment:95058600" } ] } ] } ] } ``` ``` -------------------------------- ### GET /v8/routes - Route Summary Example Source: https://www.here.com/docs/bundle/routing-api-developer-guide-v8/page/tutorials/route-section-summary.html This example demonstrates how to request route summary information, including `summary` and `travelSummary`, for a car route. It also shows how to specify a `via` point with a `stopDuration`. ```APIDOC ## GET /v8/routes ### Description Retrieves route information including summary details for each section. The `summary` parameter provides overall section information, while `travelSummary` focuses only on the travel portion, excluding pre- and post-actions. ### Method GET ### Endpoint `https://router.hereapi.com/v8/routes` ### Query Parameters - **origin** (string) - Required - The starting point of the route (latitude,longitude). - **destination** (string) - Required - The ending point of the route (latitude,longitude). - **via** (string) - Optional - Waypoint(s) to include in the route. Format: `latitude,longitude!stopDuration=seconds`. - **return** (string) - Optional - Specifies the data to be returned. Use `summary` for overall section summary and `travelSummary` for travel-specific summary. - **transportMode** (string) - Optional - The mode of transport (e.g., `car`). - **apiKey** (string) - Required - Your HERE API key. ### Request Example ``` curl -gX GET 'https://router.hereapi.com/v8/routes?'\ 'origin=52.51375,13.42462&'\ 'destination=52.52332,13.42800&'\ 'via=52.52426,13.43000!stopDuration=120&'\ 'return=polyline,summary,travelSummary&'\ 'transportMode=car&'\ 'apiKey=YOUR_API_KEY' ``` ### Response #### Success Response (200) - **routes** (array) - Contains route objects. - **id** (string) - Unique identifier for the route. - **sections** (array) - Contains section objects within the route. - **id** (string) - Unique identifier for the section. - **postActions** (array) - Actions that occur after the main travel in a section. - **action** (string) - Type of post-action (e.g., `wait`). - **duration** (number) - Duration of the action in seconds. - **summary** (object) - Summary information for the entire section. - **duration** (number) - Total duration of the section in seconds. - **length** (number) - Total length of the section in meters. - **baseDuration** (number) - Base duration of the section in seconds, excluding traffic. - **travelSummary** (object) - Summary information for the travel portion of the section. - **duration** (number) - Duration of the travel portion in seconds. - **length** (number) - Length of the travel portion in meters. - **baseDuration** (number) - Base duration of the travel portion in seconds, excluding traffic. - **polyline** (string) - Encoded polyline representing the route geometry. - **transport** (object) - Information about the transport mode. - **mode** (string) - The transport mode used for this section. #### Response Example ```json { "routes": [ { "id": "ceab8139-1857-48d3-9f04-40e1c993c8e1", "sections": [ { "id": "3542b673-a1ae-4363-81cf-8326e6b10307", "postActions": [ { "action": "wait", "duration": 120 } ], "summary": { "duration": 294, "length": 1281, "baseDuration": 256 }, "travelSummary": { "duration": 174, "length": 1281, "baseDuration": 136 }, "polyline": "...", "transport": { "mode": "car" } }, { "id": "43d61f69-5591-4dd6-81e1-ca4c76c91c27" } ] } ] } ``` ``` -------------------------------- ### GET /routes - U-turn Permission Example Source: https://www.here.com/docs/bundle/routing-api-developer-guide-v8/page/tutorials/route-uturnpermission.html This example demonstrates how to calculate a route with specific U-turn permissions at a stopover waypoint. The `uTurnPermission` parameter can be set to `allow` or `avoid` for individual `via` waypoints, overriding global settings. ```APIDOC ## GET /routes ### Description Calculates a route with specific U-turn permissions at a stopover waypoint. ### Method GET ### Endpoint `https://router.hereapi.com/v8/routes` ### Query Parameters - **origin** (string) - Required - The starting point for the route (latitude,longitude). - **destination** (string) - Required - The ending point for the route (latitude,longitude). - **via** (string) - Optional - A stopover waypoint. Can include `uTurnPermission=allow` or `uTurnPermission=avoid` to control U-turns at this specific waypoint. - **return** (string) - Optional - Specifies the data to be returned (e.g., polyline, summary, actions, instructions). - **transportMode** (string) - Optional - The mode of transport (e.g., car, truck). - **departureTime** (string) - Optional - The desired departure time. - **apiKey** (string) - Required - Your HERE API key. ### Request Example ```curl curl -gX GET 'https://router.hereapi.com/v8/routes?'\ 'origin=52.507079%2C13.396498&'\ 'destination=52.507079%2C13.393774&'\ 'via=52.506783%2C13.388813%3BuTurnPermission%3Davoid&'\ 'return=polyline%2Csummary%2Cactions%2Cinstructions&'\ 'transportMode=car&'\ 'departureTime=any&'\ 'apiKey=YOUR_API_KEY' ``` ### Response #### Success Response (200) - **routes** (array) - An array of route objects. - **sections** (array) - An array of section objects within a route. - **actions** (array) - An array of actions within a section. - **text** (string) - Description of the action. - **direction** (string) - Direction of the action. - **offset** (number) - Offset from the start of the section. - **reВведите** (string) - Indicates if a U-turn is involved. #### Response Example ```json { "routes": [ { "sections": [ { "actions": [ { "text": "Start at current location.", "direction": " ileri", "offset": 0, "reВведите": "none" }, { "text": "Turn right onto Potsdamer Platz.", "direction": "right", "offset": 25, "reВведите": "none" }, { "text": "Make a U-turn at the next intersection.", "direction": "uTurn", "offset": 150, "reВведите": "allow" } ] } ] } ] } ``` ``` -------------------------------- ### Calculate Route with Minimum Charge at Destination Source: https://www.here.com/docs/bundle/routing-api-developer-guide-v8/page/tutorials/calculate-route-with-charging-reserve.html This example demonstrates how to calculate a route with specific minimum charge requirements at the destination and charging stations. It includes parameters for EV consumption, traffic, and charging behavior. ```APIDOC ## GET /v8/routes ### Description Calculates a route for an electric vehicle, ensuring a minimum charge level at the destination and optionally at charging stations along the route. ### Method GET ### Endpoint `/v8/routes` ### Query Parameters - **`ev[minChargeAtDestination]`** (number) - Optional - The minimum required charge (in kWh) at the destination waypoint. Defaults to 0. - **`ev[minChargeAtFirstChargingStation]`** (number) - Optional - The minimum required charge (in kWh) at the first charging station waypoint. Defaults to 0. - **`ev[minChargeAtChargingStation]`** (number) - Optional - The minimum required charge (in kWh) at all subsequent charging station waypoints (after the first one, if specified). Defaults to 0. - **`departureTime`** (string) - Optional - The desired departure time. Can be 'any' or a specific timestamp. - **`origin`** (string) - Required - The starting point of the route (latitude,longitude). - **`destination`** (string) - Required - The ending point of the route (latitude,longitude). - **`ev[connectorTypes]`** (string) - Optional - Specifies the allowed connector types for charging stations. - **`transportMode`** (string) - Required - The mode of transport, e.g., 'car'. - **`return`** (string) - Optional - Specifies the return format, e.g., 'summary'. - **`ev[freeFlowSpeedTable]`** (string) - Optional - A table defining speed limits and corresponding consumption values. - **`ev[trafficSpeedTable]`** (string) - Optional - A table defining traffic speeds and corresponding consumption values. - **`ev[auxiliaryConsumption]`** (number) - Optional - Auxiliary energy consumption in kWh per hour. - **`ev[ascent]`** (number) - Optional - Energy consumption due to ascent in kWh per km. - **`ev[descent]`** (number) - Optional - Energy consumption due to descent in kWh per km. - **`ev[makeReachable]`** (boolean) - Optional - If true, the API will try to find a route that makes the destination reachable. - **`ev[initialCharge]`** (number) - Optional - The initial charge of the electric vehicle in kWh. - **`ev[maxCharge]`** (number) - Optional - The maximum charge capacity of the electric vehicle in kWh. - **`ev[chargingCurve]`** (string) - Optional - Defines the charging curve of the electric vehicle. - **`ev[maxChargeAfterChargingStation]`** (number) - Optional - The maximum charge level to aim for after a charging station. - **`apiKey`** (string) - Required - Your HERE API key. ### Request Example ```json curl -gX GET 'https://router.hereapi.com/v8/routes?'\ 'departureTime=any&'\ 'origin=52.533959,13.404780&'\ 'ev[connectorTypes]=iec62196Type2Combo&'\ 'transportMode=car&'\ 'destination=51.741505,14.352413&'\ 'return=summary&'\ 'ev[freeFlowSpeedTable]=10,0.130,20,0.132,30,0.136,40,0.142,50,0.151,60,0.161,70,0.176,80,0.194,90,0.214,100,0.237,110,0.264,120,0.290,130,0.321,140,0.354,150,0.389,160,0.426,170,0.466,180,0.509,190,0.554,200,0.601&'\ 'ev[trafficSpeedTable]=0,0.349,27,0.319,45,0.329,60,0.266,75,0.287,90,0.318,100,0.33,110,0.335,120,0.35,130,0.36,250,0.36&'\ 'ev[auxiliaryConsumption]=1.8&'\ 'ev[ascent]=9&'\ 'ev[descent]=4.3&'\ 'ev[makeReachable]=true&'\ 'ev[initialCharge]=48&'\ 'ev[maxCharge]=80&'\ 'ev[chargingCurve]=0,96,8,193,16,200,32,190,48,96,64,48,80,5&'\ 'ev[maxChargeAfterChargingStation]=72&'\ 'ev[minChargeAtChargingStation]=8&'\ 'ev[minChargeAtDestination]=50&'\ 'apiKey=YOUR_API_KEY' ``` ### Response #### Success Response (200) - **`routes`** (array) - An array of route objects. - **`id`** (string) - The unique identifier for the route. - **`sections`** (array) - An array of route sections. - **`id`** (string) - The unique identifier for the section. - **`type`** (string) - The type of the section (e.g., 'vehicle'). - **`postActions`** (array) - Actions to be performed after arriving at a waypoint (e.g., charging). - **`action`** (string) - The type of action (e.g., 'charging'). - **`duration`** (number) - The duration of the action in seconds. - **`consumablePower`** (number) - The power consumed during the action. - **`arrivalCharge`** (number) - The charge level upon arrival at the waypoint. - **`targetCharge`** (number) - The target charge level after the action. - **`departure`** (object) - Information about the departure from the waypoint. - **`place`** (object) - Details of the departure location. - **`charge`** (number) - The charge level at departure. - **`arrival`** (object) - Information about the arrival at the waypoint. - **`place`** (object) - Details of the arrival location. - **`charge`** (number) - The charge level upon arrival. - **`summary`** (object) - Summary of the route section. - **`duration`** (number) - The total duration of the section in seconds. - **`length`** (number) - The total length of the section in meters. - **`consumption`** (number) - The total energy consumption for the section. - **`baseDuration`** (number) - The base duration of the section without traffic. - **`transport`** (object) - Transport mode details. - **`mode`** (string) - The transport mode (e.g., 'car'). - **`consumptionType`** (string) - The type of consumption (e.g., 'electric'). #### Response Example ```json { "routes": [ { "id": "b30cf55f-fee2-4669-afa6-1c9dbaff5ec4", "sections": [ { "id": "87f5d58d-b57e-4441-a56a-581c1f7c4f09", "type": "vehicle", "postActions": [ { "action": "charging", "duration": 1521, "consumablePower": 300, "arrivalCharge": 18.6044, "targetCharge": 66.9999 } ], "departure": { "place": { "type": "place", "location": { "lat": 52.5338755, "lng": 13.4050137, "elv": 92 }, "originalLocation": { "lat": 52.5339589, "lng": 13.4047799 } }, "charge": 48 }, "arrival": { "place": { "type": "chargingStation", "location": { "lat": 51.8887524, "lng": 13.8374168, "elv": 105 }, "displayLocation": { "lat": 51.888672, "lng": 13.8373939 }, "id": "evcp0-ODE3ODJjZmUtMmFlNy0xMWVmLWJhMTUtNDIwMTBhYTQwMDQz", "name": "EV Charging Station", "attributes": { "power": 300, "current": 375, "voltage": 800, "supplyType": "dc", "connectorType": "iec62196Type2Combo" } }, "charge": 18.6044 }, "summary": { "duration": 5234, "length": 85293, "consumption": -18.9999, "baseDuration": 5234 }, "transport": { "mode": "car" }, "consumptionType": "electric" }, { "id": "2e6898fe-2e8e-4d6a-9a6b-cbc920d3bf87", "type": "vehicle", "departure": { "place": { "type": "chargingStation", "location": { "lat": 51.8887524, "lng": 13.8374168, "elv": 105 }, "displayLocation": { "lat": 51.888672, "lng": 13.8373939 }, "id": "evcp0-ODE3ODJjZmUtMmFlNy0xMWVmLWJhMTUtNDIwMTBhYTQwMDQz", "name": "EV Charging Station", "attributes": { "power": 300, "current": 375, "voltage": 800, "supplyType": "dc", "connectorType": "iec62196Type2Combo" } }, "charge": 18.6044 }, "arrival": { "place": { "type": "place", "location": { "lat": 51.741505, "lng": 14.352413, "elv": 130 }, "originalLocation": { "lat": 51.741505, "lng": 14.352413 } }, "charge": 50.0001 }, "summary": { "duration": 5234, "length": 85293, "consumption": -18.9999, "baseDuration": 5234 }, "transport": { "mode": "car" }, "consumptionType": "electric" } ] } ] } ``` ``` -------------------------------- ### GET /routes - Requesting Spans with Multiple Attributes Source: https://www.here.com/docs/bundle/routing-api-developer-guide-v8/page/concepts/span.html This example shows how to request spans using multiple attributes ('names', 'carAttributes') to get more granular route data. The response will contain more spans as attributes change more frequently. ```APIDOC ## GET /routes ### Description Requests route information including spans based on multiple attributes, leading to potentially more granular results. ### Method GET ### Endpoint https://router.hereapi.com/v8/routes ### Parameters #### Query Parameters - **origin** (string) - Required - The starting point of the route (latitude,longitude). - **destination** (string) - Required - The ending point of the route (latitude,longitude). - **return** (string) - Required - Specifies the data to be returned. Must include 'polyline'. - **spans** (string) - Required - A comma-separated list of attributes to generate spans for. Example: 'names,carAttributes'. - **transportMode** (string) - Required - The mode of transport (e.g., 'pedestrian', 'car'). - **apiKey** (string) - Required - Your HERE API key. ### Request Example ```bash curl -gX GET 'https://router.hereapi.com/v8/routes?'\ 'origin=52.544816,13.367221&'\ 'destination=52.544862,13.365931&'\ 'return=polyline&'\ 'spans=names,carAttributes&'\ 'transportMode=pedestrian&'\ 'apiKey=YOUR_API_KEY' ``` ### Response #### Success Response (200) - **polyline** (string) - The encoded polyline of the route. - **spans** (array) - An array of span objects, each containing an offset and attribute data. - **offset** (integer) - The starting index of the span within the polyline coordinates. - **names** (array) - An array of name objects for the span. - **value** (string) - The name value. - **language** (string) - The language code for the name. - **carAttributes** (array) - An array of car-specific attributes for the span (e.g., 'open', 'noThrough'). #### Response Example ```json { "polyline": "BGozinkDq77vZApLwCnfA7aQjL", "spans": [ { "offset": 0, "carAttributes": [ "open" ], "names": [ { "value": "Gerichtstraße", "language": "de" } ] }, { "offset": 1, "names": [ { "value": "Gerichtstraße", "language": "de" } ] }, { "offset": 3, "carAttributes": [ "open", "noThrough" ], "names": [ { "value": "Gerichtstraße", "language": "de" }, { "value": "Max-Josef-Metzger-Platz", "language": "de" } ] } ] } ``` ```