How do I get timetable info?

Hi,
I’m trying to get timetable info from the unified API. According to the docs, it’s at /Line/{id}/Timetable/{fromStopPointId}
However, going to these URLs (eg https://api.tfl.gov.uk/Line/Bakerloo/Timetable/940GZZLUCHX ) just gives a disambiguation page. If I follow a URL from one of the disambiguation options (eg https://api.tfl.gov.uk/Line/Bakerloo/Timetable/940GZZLUCHX/outbound ), I get a 404

I’ve tried it with a few different modes (eg https://api.tfl.gov.uk/line/rb1/timetable/930GGNW/inbound ), and get 404s for all the ones I try.

Am I doing something wrong? The documentation I’ve found isn’t especially clear on the matter.

Thanks,
Luke

1 Like

Hi,

I am having the exact same problem for this query https://api.tfl.gov.uk/Line/thameslink/Timetable/910GHERNEH

I can’t find any help in the documentation, and I went through a lot of the TFL tech blog posts without any success.

I have also tried to use the push API based on this example to try to get the times, but it doesn’t seem to work for my line or station.

This API looks really cool with plenty of features but there is a lack of high level documentation and I find it hard to achieve basics things.

Help would be greatly appreciated!

Thanks
Thomas

I think you’ve both come across a bug in our routing. The disambiguation tells you to go to /Line/Bakerloo/Timetable/940GZZLUCHX/inbound but that gives you a resource not found

https://api.tfl.gov.uk/Line/Bakerloo/Timetable/940GZZLUCHX?direction=inbound
or
https://api.tfl.gov.uk/Line/thameslink/Timetable/910GHERNEH?direction=inbound

Is the correct URL form to use. I will raise a bug in our tracker and get the documentation updated when it is fixed.

2 Likes

Hi Tim

Thanks for your help.

The second link you’ve sent returns

statusErrorMessage: "The stop you selected has now been removed from the route, and therefore we cannot show you a timetable. The route page will be updated shortly to reflect these changes."

Any idea what’s happening? Is the stop id incorrect?

What I would like to achieve in the end is to get the live departure times from Herne Hill and know if they are any delays, so if you know what endpoint I should use to obtain that it would be super helpful!!

Thank you

Thomas

Unfortunately we don’t currently support National Rail timetables or live arrivals. We do have the status of National Rail lines and stops (i.e if there are any disruptions)

https://api.tfl.gov.uk/Line/Mode/national-rail/Status
https://api.tfl.gov.uk/StopPoint/Mode/national-rail/Disruption

(You can also use individual stop or lineIds with those APIs e.g. thameslink or 910GHERNEH)

We use some of the live arrivals feed to support TfL Rail, so I’m investigating why we can’t support the other operators.

Thanks Tim. I wonder how apps like City Mapper have access to the live timetables (including delays on a particular train) for Thameslink; do you have a specific contract with them for that matter?

Thanks for the clarification Tim.
Took me a while to understand the output of the timetable endpoints, but then I realised “stations” and “stops” were for the whole line, but “timetable” was specific to the stop.

Is there a way of matching up realtime Arrival data with that in the timetable? I know there’s little point in doing it for frequent underground services. But it’d be very helpful on river bus services to display if a given boat is running on time or how late it is.

@tfluke there’s no easy way of doing that, vehicleId in predictions doesn’t correspond to anything in the timetable, so we don’t know which service from the timetable is being served by the arrivals information. The backend systems simply don’t expose that information to us currently.

@jazzytomato its likely they are reading that from the “Darwin” feed, which is where we source the overground and TfL Rail arrivals and timetable data, ignoring other operators. We are investigating whether we can expose all of the Darwin feed in the Unified API.

I thought as much. I’ve seen Google Maps now attempts to label tube trains as “early” or “delayed” in its journey planner. But it gets it woefully wrong.

Check https://datafeeds.nationalrail.co.uk/ and http://wiki.openraildata.com/ for information on the Darwin feed

Progress on this bug please @Tim as its still returning 404 and we are now 5 months on.
Thanks

Hi @ryan.forsyth, I’m afraid there hasn’t been any progress on this one. It’s a low priority for us since you can reach the correct URL by reformatting the disambiguation URL from:

/Line/Bakerloo/Timetable/940GZZLUCHX/inbound

to

/Line/Bakerloo/Timetable/940GZZLUCHX?direction=inbound

```SVC-3539`

Thanks for explaining the situation with this bug.

Having followed the documentation in Swagger, I was struggling to retrieve a timetable for london-overground for Hampstead Heath using the following API call:

https://api.tfl.gov.uk/Line/london-overground/Timetable/910GHMPSTDH

Changing to

https://api.tfl.gov.uk/Line/london-overground/Timetable/910GHMPSTDH?direction=inbound

did the trick. A small update to the documentation on Swagger bringing attention to this might help others from going too far down the rabbit hole!

1 Like