Public Transit API v3 Developer's Guide

Line Info (Deprecated)

Note: This API has been deprecated as a result of low customer usage. Currently, a replacement is not planned.

User Story

The user wants to retrieve details of the transit lines going through a particular station, such as the Mountain Line Transfer Center (stnId=703280098).

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.

https://transit.ls.hereapi.com/v3/lines/by_stn_id.json
?apiKey={YOUR_API_KEY}
&stnId=703280098
&graph=1
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 10 transit lines by default, can be configured using the optional max parameter
  • each line element includes the information about the line's properties and segments:
    • name, direction, and transit mode of the line
    • list of segment IDs of the main segment and all segments of the line
{
  Res: {
    serviceUrl: "http://search.st.transit.ls.hereapi.com/t0k2/lines",
    LineInfos: {
      LineInfo: [{
        Transport: {
          name: "8",
          dir: "Southgate Mall",
          mode: 5,
          At: {
            color: "#F3C727",
            textColor: "#000000"
          }
        },
        LineSegments: [{
          type: "main",
          seg_ids: "0 2 34 35 37 38 39 40 41 42 43 44 45 46 47 6 7 8 9 10 11 12 13 14 15 16 17 18 19 56"
        },
        {
          type: "all",
          seg_ids: "0 2 6 7 8 9 10 11 12 13 14 15 16 17 18 19 34 35 37 38 39 40 41 42 43 44 45 46 47 56"
        }]
      }]
    },
    PathSegments: {
      PathSeg: [{
        id: "0",
        runs: "21",
        duration: "PT0H1M0S",
        from: "720390000",
        to: "720390016",
        graph: "46.873711,-113.99567 46.8735766,-113.99519 46.8735552,-113.99496 46.872782,-113.99232"
      },
      {
        id: "1",
        runs: "21",
        duration: "PT0H1M0S",
        from: "720390015",
        to: "720390159",
        graph: "46.8455809,-114.02622 46.8465185,-114.02622 46.8467546,-114.02645 46.8477952,-114.02645 46.8484604,-114.0262 46.8488467,-114.02622 46.8488395,-114.02736"
      },
      {
        id: "2",
        runs: "21",
        duration: "PT0H1M0S",
        from: "720390016",
        to: "720390294",
        graph: "46.872782,-113.99232 46.8726861,-113.99199 46.8716884,-113.99262 46.8711341,-113.9908"
      },
      
      ... more lines ...
      
      },
      {
        id: "56",
        runs: "21",
        duration: "PT0H5M0S",
        from: "720390501",
        to: "720390329",
        graph: "46.8440029,-114.03002 46.8439972,-114.02614 46.8446517,-114.02514 46.8451023,-114.02577 46.8454671,-114.02622 46.8455809,-114.02622"
      }],
      RefPathSeg: [{
        id: "24",
        runs: "21",
        duration: "PT0H1M0S",
        seg_id: "17",
        reverse: 1
      }]
    },
    Stations: {
      Stn: [{
        id: "720390000",
        name: "Mountain Line Transfer Center",
        x: -113.9956,
        y: 46.873797
      },
      {
        id: "720390015",
        name: "Southgate Mall",
        x: -114.02617,
        y: 46.845581
      },
      {
        id: "720390329",
        name: "Southgate Mall",
        x: -114.02632,
        y: 46.845581
      },
      
      ... more lines ...
      
      {
        id: "720390300",
        name: "S 5th St W & Myrtle St",
        x: -113.99877,
        y: 46.865042
      },
      {
        id: "720390301",
        name: "S 5th St W & Chestnut St",
        x: -114.00185,
        y: 46.86505
      }]
    }
  }
}