Journey Planner URL stop ids


#1

via e-mail:

In the docs where you mention “Journey planning - Westminster to Bank”, you have 2 examples:

ex 1: https://api.tfl.gov.uk/journey/journeyresults/westminster/to/bank

ex 2: https://api.tfl.gov.uk/journey/journeyresults/1000266/to/1000013

My app already retrieve the list of your stations and their geo location from your kml file, and to do API calls it would be better to use numbers instead of the stations name.
I don’t know if they are called NapTan codes.

I have tested the following url https://api.tfl.gov.uk/journey/journeyresults/allsaints/to/aldgate, and it seems to work, but i’m afraid that by only using the names some errors might happen if they are not exactly the same.


#2

It is a good idea to use the ids if you know them, as names may result in disambiguation if they don’t give an exact match.

The ids in the second URL https://api.tfl.gov.uk/journey/journeyresults/1000266/to/1000013 are the ICS stop code, which is returned from the StopPoint API in the icsCode field.

$ curl -s "https://api.tfl.gov.uk/StopPoint/940GZZLUWSM | jq . | grep ics

  "icsCode": "1000266",

or StopPoint search as icsId

$ curl -s "https://api.tfl.gov.uk/StopPoint/Search/Westminster" | jq . | grep ics

      "icsId": "1000266",