Public Transit API v3 Developer's Guide

Next Nearby Departures

User Story

The user wants to retrieve departure information from a given station, in this case Harrison / Motor View (stnId=703280098), at 2020-06-24T07:30:00.

Note: This service is subject to Terms and Conditions as described in Supplier Terms for Developers Using HERE Location Platform APIs.

Request

The query parameter stnId can be obtained by making a station search request by name or by geocoordinates, for example Search for Transit Stations by Name. The time parameter is specified in ISO 8601 format, 2020-06-24T07:30:00. The lang parameter is specified in ISO 639-1 format, en for English.

https://transit.ls.hereapi.com/v3/board.json
?apiKey={YOUR_API_KEY}
&lang=en
&stnId=703280098
&time=2020-06-24T07%3A30%3A00
Note: This example uses a HERE API Key to authenticate your request. For information on other possible options, see Authentication Guide. For examples of how to use the other authentication options with the Public Transit API v3, see Authentication Examples.

Response

The response to the request contains the following information blocks:
  • a maximum of 40 departures relative to the time specified from the station in the request as well as nearby stations by default, can be configured using the optional max parameter
  • each departure board element includes the following information:
    • departure time
    • name and ID of the transit stop or station the service departs from
    • name and number of the transit service
    • type of the transit service
    • direction or head-sign of the service
    • optionally, the color of the service line
{
  "Res": {
    "serviceUrl": "http://ip-10-123-14-239.eu-west-1.compute.internal:8080/hafasproxy/G3L",
    "NextDepartures": {
      "Dep": [
        {
          "Stn": {
            "id": "703280098#105",
            "name": "Harrison / Motor View",
            "x": -112.507865,
            "y": 45.953279
          },
          "Transport": {
            "At": {
              "category": "Bus",
              "color": "#FF6600",
              "operator": "bKy15000",
              "textColor": "#FFFFFF"
            },
            "dir": "Transfer Center",
            "mode": 5,
            "name": "Orange - Harrison"
          },
          "journey_ctx": "1|261|0|105|11122017",
          "time": "2017-12-11T07:32:00"
        },
        {
          "Stn": {
            "id": "703280077#105",
            "name": "Harrison / Motor View",
            "x": -112.508188,
            "y": 45.953764
          },
          "Transport": {
            "At": {
              "category": "Bus",
              "color": "#FF6600",
              "operator": "bKy15000",
              "textColor": "#FFFFFF"
            },
            "dir": "Montana Tech South",
            "mode": 5,
            "name": "Orange - Harrison"
          },
          "journey_ctx": "1|263|1|105|11122017",
          "time": "2017-12-11T07:59:00"
        },

        ... more departures ...

        {
          "Stn": {
            "id": "703280098#105",
            "name": "Harrison / Motor View",
            "x": -112.507865,
            "y": 45.953279
          },
          "Transport": {
            "At": {
              "category": "Bus",
              "color": "#FF6600",
              "operator": "bKy15000",
              "textColor": "#FFFFFF"
            },
            "dir": "Transfer Center",
            "mode": 5,
            "name": "Orange - Harrison"
          },
          "journey_ctx": "1|263|9|105|11122017",
          "time": "2017-12-11T16:02:00"
        }
      ],
      "Operators": {
        "Op": [
          {
            "At": {
              "phone": "(406) 497-6515"
            },
            "Link": [
              {
                "href": "https://transit.ls.hereapi.com/r?apiKey={YOUR_API_KEY}=http://www.buttebus.org/",
                "text": "Butte-Silver Bow",
                "type": "website"
              }
            ],
            "code": "bKy15000",
            "name": "Butte-Silver Bow",
            "type": "TT"
          }
        ]
      }
    }
  }
}