Timetable Links Broken with Same Inbound/Outbound Stop

Hi,

Timetable links are broken for routes with same outbound / inbound stop

as an example

https://api.tfl.gov.uk/line/W4/timetable/490003092W

returns alternative links /Line/W4/Timetable/490003092W/inbound /Line/W4/Timetable/490003092W/outbound

both endpoints return 404 EntityNotfoundException {“$type”:“Tfl.Api.Presentation.Entities.ApiError, Tfl.Api.Presentation.Entities”,“timestampUtc”:“2019-05-31T10:54:38.0928554Z”,“exceptionType”:“EntityNotFoundException”,“httpStatusCode”:404,“httpStatus”:“NotFound”,“relativeUri”:“/Line/W4/Timetable/490003092W/inbound”,“message”:“Resource not found: http://api:8001/Line/W4/Timetable/490003092W/inbound”}

willa,

The “uri” paremeter that is retruned isn’t one that the unified APIs, but of some internal, unspecified system.

You can use them directly to call the Unified API as they are just resource labels (URI) rather than web addresses (URL).

Internally they use SOAP - SOAP - Wikipedia

Hi Brian

…/line/W4/timetable/490003092W returns 200 OK response acknowledging the resource exists

{“$type”:“Tfl.Api.Presentation.Entities.TimetableResponse, Tfl.Api.Presentation.Entities”,“disambiguation”:{“$type”:“Tfl.Api.Presentation.Entities.Timetables.Disambiguation, Tfl.Api.Presentation.Entities”,“disambiguationOptions”:[{“$type”:“Tfl.Api.Presentation.Entities.Timetables.DisambiguationOption, Tfl.Api.Presentation.Entities”,“description”:“Ulster Gardens - Ferry Lane Primary School”,“uri”:“/Line/W4/Timetable/490003092W/outbound”},{“$type”:“Tfl.Api.Presentation.Entities.Timetables.DisambiguationOption, Tfl.Api.Presentation.Entities”,“description”:“Ferry Lane Primary School - Mitchell Road”,“uri”:“/Line/W4/Timetable/490003092W/inbound”}]}}

but when I hit the endpoint provided …/line/W4/timetable/490003092W/inbound I get 404 telling me the resource doesn’t exist

{“$type”:“Tfl.Api.Presentation.Entities.ApiError, Tfl.Api.Presentation.Entities”,“timestampUtc”:“2019-05-31T12:35:51.0587211Z”,“exceptionType”:“EntityNotFoundException”,“httpStatusCode”:404,“httpStatus”:“NotFound”,“relativeUri”:“/line/W4/timetable/490003092W/inbound”,“message”:“Resource not found: http://api:8001/line/W4/timetable/490003092W/inbound”}

I think think a few lines of code are missing somewhere…

I think you need to switch to

https://api.tfl.gov.uk/StopPoint/490003092W/arrivals

Hi Brian,

I’m not looking for live bus arrivals, but timetable info - typical sample would be

https://api.tfl.gov.uk/line/W4/timetable/490G000835

would be a working sample, but any stops with same inbound outbound naptan cannot return data and throw exception

if I were to hit all the naptans in London the same error would occur, if you hit any of these naptans on timetable you will get an error even though they are real searchable stops.

  1. 20: (2) [“1500IM504”, “1500SAINS1”]
  2. 70: (2) [“490004737R”, “490004737S”]
  3. 92: [“490004297W”]
  4. 99: [“490001252A”]
  5. 135: (4) [“490014483C”, “490000038F”, “490000038J”, “490000038G”]
  6. 142: (2) [“490011171H”, “490000070G”]
  7. 147: [“490008709S”]
  8. 165: (3) [“490011394F”, “490015350F”, “490008347G”]
  9. 166: (2) [“40004409296A”, “40004409037A”]
  10. 167: [“1500IM359”]
  11. 173: (2) [“490004947S”, “490004952E”]
  12. 178: (2) [“490020276Z”, “490020276W”]

Sometimes you need to look at the tfl.gov.uk site I think… Here’s the W4 timetable with one of the stops selected.

Shows the type of information you might get back. It’s not a “birds eye” views of the whole route, but the type of timetable you’ve seen on bus stops over the years.

A couple of weeks ago, I found that the app I use out and about (Bus Times London) now gives you the ability to view the “timetable” of arrivals for each route at the stop you have chosen. So what, you might say, you can already get stop specific timetables on the TfL website, as in the W4 example above. However, Bus Times London (with which I have no connection - honest!) are managing to generate complete lists of arrivals, that is without any of that “every 9-11 minutes” stuff. Perhaps others are already doing that but it would be interesting to know exactly how they are doing it, for example whether they are using the Datastore files or interrogating the system each time.

Full old-fashioned (that is, really useful) matrix timetables can be found on London Bus Routes, though they only include a selection of stops for each route. I like them because they actually show the huge variation in journey times across the day, whereas the timetables at stops just quote typical off peak times, which could anything from midday to late at night.

@mjcarchive If you take the Route 70 naptan 490004737R “South Kensington Station - Chiswick Business Park” (…line/70/Timetable/490004737R) from my example list and search it on that app “Bus Times London” you are talking about there is no timetable info because of this error caused downstream by TFL’s Unified API which I am highlighting in my post.

TFL used to use PDFs hosted on Amazon storage, and although the Unified API is a much better way to share data with developers - it is frustrating this hasn’t been fixed as this has been a problem for a while.

there’s a boiler plate response for the /inbound /outbound but obviously someone has forgotten to code the controller.cs to do this

I have found a solution, although this is offically not posted on TFL’s swagger file or Swagger UI as far as I can see.

If I add get parameter direction, I get the data requested (/outbound /inbound is misleading)

for anyone struggling with same problem this works:-
/line/W4/timetable/490003092W?direction=inbound
line/70/Timetable/490004737R?direction=outbound

Would be helpful if this had been recorded in the Swagger File ¯_(ツ)_/¯

1 Like