/Line/Timetable with specified destination returns invalid trains

I’m using /Line/metropolitan/Timetable/940GZZLUHOH/to/940GZZLUUXB?direction=outbound expecting to get the times of the trains departing Harrow-on-the-Hill towards Uxbridge. The trains listed under “knownJourneys” before 6am are as follows:

"knownJourneys": [
    {
        "$type": "Tfl.Api.Presentation.Entities.KnownJourney, Tfl.Api.Presentation.Entities",
        "hour": "5",
        "intervalId": 1,
        "minute": "43"
    },
    {
        "$type": "Tfl.Api.Presentation.Entities.KnownJourney, Tfl.Api.Presentation.Entities",
        "hour": "5",
        "intervalId": 0,
        "minute": "43"
    },
    {
        "$type": "Tfl.Api.Presentation.Entities.KnownJourney, Tfl.Api.Presentation.Entities",
        "hour": "5",
        "intervalId": 1,
        "minute": "47"
    },
    {
        "$type": "Tfl.Api.Presentation.Entities.KnownJourney, Tfl.Api.Presentation.Entities",
        "hour": "5",
        "intervalId": 2,
        "minute": "51"
    },
    {
        "$type": "Tfl.Api.Presentation.Entities.KnownJourney, Tfl.Api.Presentation.Entities",
        "hour": "5",
        "intervalId": 2,
        "minute": "56"
    },
    {
        "$type": "Tfl.Api.Presentation.Entities.KnownJourney, Tfl.Api.Presentation.Entities",
        "hour": "5",
        "intervalId": 0,
        "minute": "56"
    },

Looking at the “intervalId” of each train or checking the online timetable towards West Harrow and North Harrow shows that it is returning every single northbound metropolitan line train.

Hello and welcome to the forum!

The toStopPointId for this API request is only used to determine the direction of travel (outbound or inbound). When you specify 940GZZLUHOH as the fromStopPointId and 940GZZLUUXB as the toStopPointId, this indicates an inbound direction. Therefore, you will receive timetables for all inbound journeys, including services going to Amersham, Chesham and Watford, in addition to those bound for Uxbridge.

What you can do is to look at the stationIntervals data and see which intervals include 940GZZLUUXB, noting their ids. You can then filter the knownJourneys by the matching intervalIds.

I hope this helps.

1 Like