Wrong disambiguation URI when querying timetables


Sending this request (Station ID is hammersmith):

Returns a response with some disambiguations. The disambiguations all have this form:

{ "$type": "Tfl.Api.Presentation.Entities.Timetables.DisambiguationOption, Tfl.Api.Presentation.Entities", "description": "Cockfosters Underground Station - Heathrow Terminal 5 Underground Station", "uri": "/Line/piccadilly/Timetable/940GZZLUHSD/inbound" }

Sending a request with that URI returns the following error response:
{ "$type": "Tfl.Api.Presentation.Entities.ApiError, Tfl.Api.Presentation.Entities", "timestampUtc": "2022-01-15T19:42:13.5895973Z", "exceptionType": "EntityNotFoundException", "httpStatusCode": 404, "httpStatus": "NotFound", "relativeUri": "/Line/piccadilly/Timetable/940GZZLUHSD/inbound", "message": "Resource not found: http://api:8001/Line/piccadilly/Timetable/940GZZLUHSD/inbound" }

This post on the forum (How do I get timetable info? - #14 by PickleRick) shows how to get past the error, but the disambiguation URI should really be returned correctly by the API (or at least properly documented), so that it could be reused immediately. I thought that instead of reviving a thread that is more than two years old would be better.


@antglb Welcome

I would suggest that you treat the information that comes back in these error states as “pointers for developers” as they are undocumented in terms of the documentation.

Basically, don’t trust them to provide user information, just use them to look for the right API or right parameters to use.

So you might want to try for your example is https://api.tfl.gov.uk/Search/?query=940GZZLUHSD

@briantist Thanks for your reply. My main issue is that I didn’t find any useful documentation on how to use correctly the disambiguations.

@antglb With public APIs if it’s not documented, you can’t depend on it.

hi @antglb - as mentioned in the thread below, I’ve raised a bug with the dev team to look into this. It may be a while to fix however due to competing priorities (Elizabeth Line etc). The correct format to call is mentioned in that thread.