Routing API Developer's Guide

Attribute Switches

Attribute switches allow you to select the subset of response data you require for each request. By default, the API returns a list of [waypoints, summary, and legs]. If you use the routeattributes request parameter, you can add or remove elements for particular use cases from this default list.

To save bandwidth and simplify processing, the best practice is to select only the set of attributes you require, by using the none value and adding required attributes.

The most useful attribute switches to use in a public transport route request are:
  • routeattributes, which can be used to enable the output of:
    • lines or the short version li for public transport line information
    • groups, or the short version gr for maneuver group information
  • maneuverattributes, which controls additional Public Transport Maneuver information
  • linkattributes, which controls additional Public Transport link information
  • lineattributes, which controls additional Public Transport line information output
The attribute switches that should not be used in a public transport route request are:
  • routeattributes, which can be used to enable the output of:
    • RouteId, or the short version ri; RouteId for calculated route reference is not supported for Public Transport.

Examples:

To request routes for legs only:
&routeattributes=none,legs
To add shape and notes to the response, in addition to the default list:
&routeattributes=shape,notes
Optionally, you can also use the abbreviated forms:
&routeattributes=sh,no
To remove legs from the default list:
&routeattributes=-legs
To add notes to the previous example, thus returning waypoints, summary and notes, you can use:
&routeattributes=-legs,notes
If all attributes except legs are required, use the all value and then remove the unnecessary attributes. The following code snippet returns the whole attribute set except legs:
&routeattributes=all,-legs

For a complete list of attribute switches available in the API, see RouteRepresentationOptionsType.