Public Transit API Developer's Guide

Earlier/Later Transit Routes (Deprecated)

Note: This endpoint has been deprecated and will be removed in the near future.

User Story

The user wants to retrieve earlier or later transit routes for all transit modes based on a previously calculated transit route.

Note: This service is subject to Terms and Conditions as described in Supplier Terms for Developers Using HERE Location Platform APIs. To request access, contact us.

Request

The query parameter ctx represents the context of a section from the initial route which can be obtained from the Connections/Connection/Sections/Sec element of the response for the initial transit route request. For reference, use the request in Transit Route.

Note: Both query parameters ctx and serviceUrl expire after a few minutes. You need to request a new Transit Route to obtain fresh values.
https://cit.transit.api.here.com/v3/mroute.json
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&serviceUrl={Service URL from 'Res' element in previous transit route response}
&lang=en-US
&ctx={Context of the initial route}
&direction=B
&max=1
&graph=1

Response

The response to the request contains the following information blocks:
  • a total of 3 transit connections or journeys right before the requested Transit Route
  • each journey includes the following information:
    • Multiple transit segments with each segment (representing either a pedestrian or a transit segment) containing departure/arrival times, duration and coordinates
    • The transit segment shows the actual stops/stations of the departure, arrival and all intermediate stops in between
  • A set of operators who run the services included in the journeys, including operator code, operator name and links to operator websites, if any.
{
  "Res": {
    "serviceUrl": "http://ip-10-124-93-102.eu-west-1.compute.internal:8080/hafasproxy/G1C",
    "Connections": {
      "context": "0b86c1fe-f03e-44ba-872b-4802b9f9f32e",
      "Connection": [
        {
          "id": "R0004ad-C0",
          "duration": "PT58M",
          "transfers": 1,
          "Dep": {
            "time": "2017-04-11T21:32:00",
            "Addr": {
              "x": -87.638641,
              "y": 41.884447
            }
          },
          "Arr": {
            "time": "2017-04-11T22:30:00",
            "Addr": {
              "x": -87.689133,
              "y": 41.975696
            }
          },
          "Sections": {
            "Sec": [
              {
                "mode": 20,
                "id": "R0004ad-C0-S0",
                "Dep": {
                  "time": "2017-04-11T21:32:00",
                  "Addr": {
                    "x": -87.638641,
                    "y": 41.884447
                  },
                  "Transport": {
                    "mode": 20
                  }
                },
                "Journey": {
                  "duration": "PT6M",
                  "distance": 479
                },
                "Arr": {
                  "time": "2017-04-11T21:38:00",
                  "Stn": {
                    "id": "418803919#104",
                    "name": "Jefferson + Lake",
                    "x": -87.642686,
                    "y": 41.885615
                  }
                }
              },
              {
                "mode": 5,
                "id": "R0004ad-C0-S1",
                "Dep": {
                  "time": "2017-04-11T21:38:00",
                  "Stn": {
                    "id": "418803919#104",
                    "name": "Jefferson + Lake",
                    "x": -87.642686,
                    "y": 41.885615
                  },
                  "Transport": {
                    "mode": 5,
                    "dir": "Jefferson Park Blue Line",
                    "name": "56",
                    "At": {
                      "operator": "1gA48700",
                      "category": "Bus"
                    }
                  }
                },
                "Journey": {
                  "duration": "PT19M",
                  "Stop": [
                    {
                      "dep": "2017-04-11T21:38:00",
                      "Stn": {
                        "id": "418803919#104",
                        "name": "Jefferson + Lake",
                        "x": -87.642686,
                        "y": 41.885615
                      }
                    },
                    {
                      "dep": "2017-04-11T21:39:00",
                      "Stn": {
                        "id": "418803920#104",
                        "name": "Fulton + Desplaines",
                        "x": -87.644079,
                        "y": 41.886847
                      }
                    },
                    {
                      "dep": "2017-04-11T21:40:00",
                      "Stn": {
                        "id": "418811022#104",
                        "name": "Desplaines + Fulton/Milwaukee/Kinzie",
                        "x": -87.644151,
                        "y": 41.888096
                      }
                    },
                    {
                      "dep": "2017-04-11T21:41:00",
                      "Stn": {
                        "id": "418810586#104",
                        "name": "Milwaukee + Hubbard/Union",
                        "x": -87.646093,
                        "y": 41.890317
                      }
                    },
                    {
                      "dep": "2017-04-11T21:42:00",
                      "Stn": {
                        "id": "418810017#104",
                        "name": "Milwaukee + Grand/Halsted (Blue Line)",
                        "x": -87.647989,
                        "y": 41.891539
                      }
                    },
                    {
                      "dep": "2017-04-11T21:43:00",
                      "Stn": {
                        "id": "418803921#104",
                        "name": "Milwaukee + Erie",
                        "x": -87.650785,
                        "y": 41.89349
                      }
                    },
                    {
                      "dep": "2017-04-11T21:44:00",
                      "Stn": {
                        "id": "418803922#104",
                        "name": "Milwaukee + Carpenter",
                        "x": -87.65332,
                        "y": 41.895081
                      }
                    },
                    {
                      "dep": "2017-04-11T21:44:00",
                      "Stn": {
                        "id": "418803923#104",
                        "name": "Milwaukee + Chicago",
                        "x": -87.655576,
                        "y": 41.896474
                      }
                    },
                    {
                      "dep": "2017-04-11T21:45:00",
                      "Stn": {
                        "id": "418810587#104",
                        "name": "Milwaukee + Elston",
                        "x": -87.657446,
                        "y": 41.897643
                      }
                    },
                    {
                      "dep": "2017-04-11T21:47:00",
                      "Stn": {
                        "id": "418803924#104",
                        "name": "Milwaukee + Noble",
                        "x": -87.66221,
                        "y": 41.900825
                      }
                    },
                    {
                      "dep": "2017-04-11T21:47:00",
                      "Stn": {
                        "id": "418803925#104",
                        "name": "Milwaukee + Thomas",
                        "x": -87.663954,
                        "y": 41.901832
                      }
                    },
                    {
                      "dep": "2017-04-11T21:48:00",
                      "Stn": {
                        "id": "418803926#104",
                        "name": "Milwaukee + Haddon",
                        "x": -87.665455,
                        "y": 41.902794
                      }
                    },
                    {
                      "dep": "2017-04-11T21:49:00",
                      "Stn": {
                        "id": "418803927#104",
                        "name": "Milwaukee + Ashland/Division (Blue Line)",
                        "x": -87.667325,
                        "y": 41.903989
                      }
                    },
                    {
                      "dep": "2017-04-11T21:50:00",
                      "Stn": {
                        "id": "418803928#104",
                        "name": "Milwaukee + Paulina",
                        "x": -87.669878,
                        "y": 41.905607
                      }
                    },
                    {
                      "dep": "2017-04-11T21:51:00",
                      "Stn": {
                        "id": "418810301#104",
                        "name": "Milwaukee + Wolcott/Wood",
                        "x": -87.6728,
                        "y": 41.907477
                      }
                    },
                    {
                      "dep": "2017-04-11T21:53:00",
                      "Stn": {
                        "id": "418810506#104",
                        "name": "Milwaukee + Honore",
                        "x": -87.674867,
                        "y": 41.908798
                      }
                    },
                    {
                      "dep": "2017-04-11T21:54:00",
                      "Stn": {
                        "id": "418812713#104",
                        "name": "Milwaukee + North Ave/Damen",
                        "x": -87.677771,
                        "y": 41.910659
                      }
                    },
                    {
                      "dep": "2017-04-11T21:55:00",
                      "Stn": {
                        "id": "418803930#104",
                        "name": "Milwaukee + Wabansia",
                        "x": -87.680827,
                        "y": 41.912619
                      }
                    },
                    {
                      "dep": "2017-04-11T21:55:00",
                      "Stn": {
                        "id": "418803931#104",
                        "name": "Milwaukee + Leavitt",
                        "x": -87.682319,
                        "y": 41.913599
                      }
                    },
                    {
                      "dep": "2017-04-11T21:56:00",
                      "Stn": {
                        "id": "418803932#104",
                        "name": "Milwaukee + Oakley/Moffat",
                        "x": -87.684773,
                        "y": 41.91519
                      }
                    },
                    {
                      "dep": "2017-04-11T21:57:00",
                      "Stn": {
                        "id": "418803933#104",
                        "name": "Milwaukee + Western",
                        "x": -87.6872,
                        "y": 41.916763
                      }
                    }
                  ]
                },
                "Arr": {
                  "time": "2017-04-11T21:57:00",
                  "Stn": {
                    "id": "418803933#104",
                    "name": "Milwaukee + Western",
                    "x": -87.6872,
                    "y": 41.916763
                  }
                },
                "graph": "41.885696,-87.642731 41.886811,-87.642776 41.886811,-87.644079 41.887449,-87.644268 41.888096,-87.644268 41.889049,-87.644277 41.890254,-87.646129 41.891467,-87.648034 41.891728,-87.648439 41.892213,-87.649149 41.893337,-87.65092 41.894398,-87.652547 41.894685,-87.653023 41.894955,-87.65341 41.896384,-87.65563 41.896681,-87.656089 41.896753,-87.656224 41.897616,-87.657554 41.898254,-87.658534 41.898659,-87.659217 41.899513,-87.660547 41.899827,-87.660997 41.900663,-87.662318 41.901769,-87.663999 41.902785,-87.665572 41.903908,-87.66737 41.905625,-87.669995 41.907423,-87.672845 41.908691,-87.674822 41.909509,-87.676045 41.910614,-87.677798 41.911513,-87.679227 41.912574,-87.680854 41.913608,-87.682427 41.913967,-87.683029 41.915136,-87.6848 41.916349,-87.686679 41.916664,-87.68711 41.916772,-87.68738"
              },

              ... more sections ...

            ]
          }
        },
        {
          "id": "R0004ad-C1",
          "duration": "PT48M",
          "transfers": 2,
          "Dep": {
            "time": "2017-04-11T21:42:00",
            "Addr": {
              "x": -87.638641,
              "y": 41.884447
            }
          },
          "Arr": {
            "time": "2017-04-11T22:30:00",
            "Addr": {
              "x": -87.689133,
              "y": 41.975696
            }
          },
          "Sections": {
            "Sec": [
              {
                "mode": 20,
                "id": "R0004ad-C1-S0",
                "Dep": {
                  "time": "2017-04-11T21:42:00",
                  "Addr": {
                    "x": -87.638641,
                    "y": 41.884447
                  },
                  "Transport": {
                    "mode": 20
                  }
                },
                "Journey": {
                  "duration": "PT6M",
                  "distance": 370
                },
                "Arr": {
                  "time": "2017-04-11T21:48:00",
                  "Stn": {
                    "id": "418811417#104",
                    "name": "Clinton-Green",
                    "x": -87.641778,
                    "y": 41.885678
                  },
                  "AP": {
                    "x": -87.641355,
                    "y": 41.885426,
                    "id": "418812115#104",
                    "name": "Clinton"
                  }
                }
              },
              {
                "mode": 7,
                "id": "R0004ad-C1-S1",
                "Dep": {
                  "time": "2017-04-11T21:48:00",
                  "Stn": {
                    "id": "418811417#104",
                    "name": "Clinton-Green",
                    "x": -87.641778,
                    "y": 41.885678
                  },
                  "Transport": {
                    "mode": 7,
                    "dir": "Cottage Grove",
                    "name": "Green Line",
                    "At": {
                      "operator": "1gA48700",
                      "color": "#009B3A",
                      "textColor": "#FFFFFF",
                      "category": "Train"
                    }
                  },
                  "Freq": {
                    "min": 3,
                    "max": 12,
                    "AltDep": [
                      {
                        "time": "2017-04-11T21:53:00",
                        "Transport": {
                          "mode": 7,
                          "dir": "Loop",
                          "name": "Pink Line",
                          "At": {
                            "operator": "1gA48700",
                            "color": "#E27EA6",
                            "textColor": "#FFFFFF",
                            "category": "Train"
                          }
                        }
                      },
                      {
                        "time": "2017-04-11T22:00:00",
                        "Transport": {
                          "mode": 7,
                          "dir": "Ashland/63",
                          "name": "Green Line",
                          "At": {
                            "operator": "1gA48700",
                            "color": "#009B3A",
                            "textColor": "#FFFFFF",
                            "category": "Train"
                          }
                        }
                      },
                      {
                        "time": "2017-04-11T22:05:00",
                        "Transport": {
                          "mode": 7,
                          "dir": "Loop",
                          "name": "Pink Line",
                          "At": {
                            "operator": "1gA48700",
                            "color": "#E27EA6",
                            "textColor": "#FFFFFF",
                            "category": "Train"
                          }
                        }
                      },
                      {
                        "time": "2017-04-11T22:12:00",
                        "Transport": {
                          "mode": 7,
                          "dir": "Cottage Grove",
                          "name": "Green Line",
                          "At": {
                            "operator": "1gA48700",
                            "color": "#009B3A",
                            "textColor": "#FFFFFF",
                            "category": "Train"
                          }
                        }
                      },
                      {
                        "time": "2017-04-11T22:17:00",
                        "Transport": {
                          "mode": 7,
                          "dir": "Loop",
                          "name": "Pink Line",
                          "At": {
                            "operator": "1gA48700",
                            "color": "#E27EA6",
                            "textColor": "#FFFFFF",
                            "category": "Train"
                          }
                        }
                      },
                      {
                        "time": "2017-04-11T22:24:00",
                        "Transport": {
                          "mode": 7,
                          "dir": "Ashland/63",
                          "name": "Green Line",
                          "At": {
                            "operator": "1gA48700",
                            "color": "#009B3A",
                            "textColor": "#FFFFFF",
                            "category": "Train"
                          }
                        }
                      },
                      {
                        "time": "2017-04-11T22:29:00",
                        "Transport": {
                          "mode": 7,
                          "dir": "Loop",
                          "name": "Pink Line",
                          "At": {
                            "operator": "1gA48700",
                            "color": "#E27EA6",
                            "textColor": "#FFFFFF",
                            "category": "Train"
                          }
                        }
                      },
                      {
                        "time": "2017-04-11T22:39:00",
                        "Transport": {
                          "mode": 7,
                          "dir": "Cottage Grove",
                          "name": "Green Line",
                          "At": {
                            "operator": "1gA48700",
                            "color": "#009B3A",
                            "textColor": "#FFFFFF",
                            "category": "Train"
                          }
                        }
                      },
                      {
                        "time": "2017-04-11T22:42:00",
                        "Transport": {
                          "mode": 7,
                          "dir": "Loop",
                          "name": "Pink Line",
                          "At": {
                            "operator": "1gA48700",
                            "color": "#E27EA6",
                            "textColor": "#FFFFFF",
                            "category": "Train"
                          }
                        }
                      },
                      {
                        "time": "2017-04-11T22:54:00",
                        "Transport": {
                          "mode": 7,
                          "dir": "Ashland/63",
                          "name": "Green Line",
                          "At": {
                            "operator": "1gA48700",
                            "color": "#009B3A",
                            "textColor": "#FFFFFF",
                            "category": "Train"
                          }
                        }
                      },
                      {
                        "time": "2017-04-11T22:57:00",
                        "Transport": {
                          "mode": 7,
                          "dir": "Loop",
                          "name": "Pink Line",
                          "At": {
                            "operator": "1gA48700",
                            "color": "#E27EA6",
                            "textColor": "#FFFFFF",
                            "category": "Train"
                          }
                        }
                      },
                      {
                        "time": "2017-04-11T23:09:00",
                        "Transport": {
                          "mode": 7,
                          "dir": "Cottage Grove",
                          "name": "Green Line",
                          "At": {
                            "operator": "1gA48700",
                            "color": "#009B3A",
                            "textColor": "#FFFFFF",
                            "category": "Train"
                          }
                        }
                      },
                      {
                        "time": "2017-04-11T23:12:00",
                        "Transport": {
                          "mode": 7,
                          "dir": "Loop",
                          "name": "Pink Line",
                          "At": {
                            "operator": "1gA48700",
                            "color": "#E27EA6",
                            "textColor": "#FFFFFF",
                            "category": "Train"
                          }
                        }
                      },
                      {
                        "time": "2017-04-11T23:24:00",
                        "Transport": {
                          "mode": 7,
                          "dir": "Ashland/63",
                          "name": "Green Line",
                          "At": {
                            "operator": "1gA48700",
                            "color": "#009B3A",
                            "textColor": "#FFFFFF",
                            "category": "Train"
                          }
                        }
                      },
                      {
                        "time": "2017-04-11T23:27:00",
                        "Transport": {
                          "mode": 7,
                          "dir": "Loop",
                          "name": "Pink Line",
                          "At": {
                            "operator": "1gA48700",
                            "color": "#E27EA6",
                            "textColor": "#FFFFFF",
                            "category": "Train"
                          }
                        }
                      }
                    ]
                  }
                },
                "Journey": {
                  "duration": "PT2M",
                  "Stop": [
                    {
                      "dep": "2017-04-11T21:48:00",
                      "Stn": {
                        "id": "418811417#104",
                        "name": "Clinton-Green",
                        "x": -87.641778,
                        "y": 41.885678
                      }
                    },
                    {
                      "dep": "2017-04-11T21:50:00",
                      "Stn": {
                        "id": "418811273#104",
                        "name": "Clark/Lake (Elevated)",
                        "x": -87.630883,
                        "y": 41.885741
                      }
                    }
                  ]
                },
                "Arr": {
                  "time": "2017-04-11T21:50:00",
                  "Stn": {
                    "id": "418811273#104",
                    "name": "Clark/Lake (Elevated)",
                    "x": -87.630883,
                    "y": 41.885741
                  }
                },
                "graph": "41.885705,-87.641778 41.885705,-87.641769 41.885705,-87.638838 41.885714,-87.637202 41.885723,-87.635153 41.885723,-87.633912 41.885732,-87.632843 41.885741,-87.632043 41.885741,-87.630883"
              },

              ... more sections ...

            ]
          }
        },

        ... more connections ...

      ],
      "Operators": {
        "Op": [
          {
            "code": "1gA48700",
            "name": "Chicago Transit Authority",
            "type": "TT",
            "Link": [
              {
                "type": "website",
                "href": "https://cit.transit.api.here.com/r?app_id={YOUR_APP_ID}&u=http://transitchicago.com",
                "text": "Chicago Transit Authority"
              }
            ],
            "At": {
              "phone": "1-888-YOURCTA"
            }
          }
        ]
      }
    }
  }
}