GuidesAPI Reference
Guides

What is an action

An action specifies the operation that must be performed at a specific point or during a specific portion of the route.

Examples of actions include:

  • Turn right.
  • Board a ferry.
  • At the roundabout, take the fourth exit.
  • Arrive at a destination.

Actions in a section are divided into:

  • preActions: actions which are performed before the departure of a section.
  • postActions: actions which are performed after the arrival of a section.
  • actions, turnByTurnActions: actions which are performed between the departure and arrival of a section.
📘

Note

Departure and arrival are also actions.

To learn more about sections, see this topic.

Available actions

The available actions in a section vary depending on the type of section: PedestrianSection, VehicleSection, or TransitSection. The list of actions can be extended at any point and client applications should handle such event gracefully.

To get the list of currently available actions, consult the HERE Routing v8 API API reference. Follow these steps:

  1. Get the full API reference from the /openapi endpoint:
curl -gX GET "https://router.hereapi.com/v8/openapi"
  1. Look for the action category for the desired section type : PedestrianAction, VehicleAction, or TransitAction.
  2. The mapping dictionary of the discriminator property contains all actions available for the given transport type and links them to their respective schemas.
📘

Note

Alternatively, you can use the API reference hosted on the HERE documentation portal. To see it, go to HERE Routing API v8 API Reference.

Turn-by-turn actions

Clients can also request a list of turn-by-turn actions between the departure and arrival of a section. These actions contain road information for each maneuver which enables turn-by-turn guidance support. This information includes street names, house numbers, and more.

To learn more about turn-by-turn actions and using them for guidance, see the Instructions for turn-by-turn navigation tutorial.

Road names and language preferences

In certain regions, road names and road numbers are available in more than one language.

You can find road names and numbers in these elements:

  • Turn-by-turn actions: in name and number attributes of currentRoad and nextRoad
  • Spans: in names and routeNumbers

Road names and number attributes are arrays that can contain one or more elements. The first element of the array contains the name or number that has the highest priority.

Names and numbers in the language specified in the lang parameter are the highest priority. When not available in the language set in the lang parameter, the name or number is provided in one of the local languages.

To learn more, see Supported languages.

Examples

The following examples show fragments of response bodies with sample actions.

Turn in a direction

The direction attribute specifies the direction of turns. This example shows a left turn.

"actions": [
  {...},
  {
    "action": "turn",
    "direction": "left",
    "duration": 167,
    "offset": 85,
    "severity": "light"
  },
  {...}
]

Charging electric vehicles

The postActions block can specify charging of an electric vehicle (EV).

"postActions": [
  {
    "action": "chargingSetup",
    "duration": 300
  },
  {
    "action": "charging",
    "arrivalCharge": 8.9334,
    "consumablePower": 50.0,
    "duration": 5045,
    "targetCharge": 72.0
  }
]

Detailed road information

The turnByTurnActions block can contained detailed road information.

"turnByTurnActions": [
  {...},
  {
    "action": "turn",
    "duration": 393,
    ...,
    "currentRoad": {
    "name": [
      {
        "value": "Otto-Braun-Straße",
        "language": "de"
      }
    ],
    "number": [
      {
        "value": "B2",
        "language": "de"
      }
    ]
    },
    "nextRoad": {
    "name": [
      {
        "value": "Alexanderstraße",
        "language": "de"
      }
    ],
    "number": [
      {
        "value": "B2",
        "language": "de"
      },
      {
        "value": "B5",
        "language": "de"
      }
    ]
    }
  },
  {...}
]