Can anyone Plz helppppppp me

Hi friends

Im cureently undergoing a university project which involves creating a clickable map based journey planner for the underground… ive never used the tfl api before and needed some help…

I have 2 pages on my website and im trying to use the tfl api to display data such as :

The duration of the journey
All stops on the chosen route
What line(s) the train(s) use on the selected route…

Im question is how do i display the above data on the second page of my website when a user clicks on one button (departing station) then another button(destination station) then clicks the continue button which directs the user onto the second page

Kind regards

Zed

Welcome @CyberZed404

Can I presume that you’ve already found the end-point - APIs: Details - Transport for London - API - and been able to execute things like

https://api.tfl.gov.uk/Journey/JourneyResults/940GZZLUHSD/to/940GZZLUMED

(you will need your key at some point but it will generally work for you without until you get rate-limited!)

The time it takes… is simples

image

The “All stops on the chosen route” isn’t part of what you get out of here. However, you can cross-ref the data with the likes of

https://api.tfl.gov.uk/Line/central/Route/sequence/inbound
https://api.tfl.gov.uk/Line/central/Route/sequence/outbound

to get the list of stops and their orders.

What line(s) the train(s) use on the selected route…

There are two types of line on the London system… most of the lines are stand-alone and run only their own trains: Bakerloo, Central,

And there are others that share tracks such as the Piccadilly/Metropolitan (Rayners Lane->Uxbridge), Metropolitan/Chiltern Trains (Hertfordshire), Circle/Met/H&C/District (Zone 1).

You can tell they are “sharing metals” as they use the same platform numbers.

Sometimes there are times when this looks like it might be happening but ISN’T such as the parallel running of the Bakerloo and Northern Lines between Waterloo and Embankment.

image

See Clive's UndergrounD Line Guides and Detailled London transport map (track, depot, ...) for help with this.

https://api-portal.tfl.gov.uk/ is the reference for the current TfL apis.

1 Like

Hi brian

Thank you for your reply … another question how do i get/ where do i find the APP ID and APP KEY … I have registered to use the tfl API but havent got the APP ID or APP KEY

Kind regards

zed

Sorry, it’s a bit strange. Go to httpx://api-portal.tfl.gov.uk/signin and then pick “Products” and then " 500 Requests per min and pick yourself a key (app id no longer required!)

When you’ve GOT a key, it’s listed on the “Profile” tab under “Subscriptions”!

This is still a thing? It’s one of the most unintuitive things ever :sweat_smile:

1 Like