Please see here (look for Train tab) for the list of currently available rail supplier on our live system and the supported features. We are constantly adding new rail supplier and new features on existing supplier.
Trains Integration
Rail suppliers are supported within the flights API, with a few minor differences. To illustrate these differences, an example XML is given below for a search from London to Manchester:
Request
<CommandList>
<StartRouting>
<XmlLoginId>***</XmlLoginId>
<LoginId>***</LoginId>
<Mode>Plane</Mode>
<Origin>
<Descriptor>LON</Descriptor>
<Type>airportgroup</Type>
</Origin>
<Destination>
<Descriptor>MAN</Descriptor>
<Type>airportgroup</Type>
</Destination>
<OutwardDates>
<DateOfSearch>20/03/2014-12:00</DateOfSearch>
</OutwardDates>
<MaxChanges>10</MaxChanges>
<MaxHops>10</MaxHops>
<SupplierList>
<Supplier>thetrainline</Supplier>
</SupplierList>
<Timeout>300</Timeout>
<TravellerList>
<Traveller>
<Age>30</Age>
</Traveller>
</TravellerList>
<IncrementalResults>true</IncrementalResults>
</StartRouting>
</CommandList>
Various location types for Origin and Destination can be used in the request as specified in the flight search API spec. As with flight search, to search cities <Type> should be set to "airportgroup" and to search airports <Type> should be set to "airportcode". The possible types are covered in the our start routing API documentation. In addition to this, if a specific train station is to be searched then <Type> "trainstationcode" can be entered, this can be used to specify individual stations. If you wish to do this, please contact Travelfusion for more information. A radius of 1m is recommended to ensure no other stations are searched using the specific Travelfusion train station code. A list of train stations that is supported can be requested by the ListTrainStations command documented below.
The results will be very similar to normal flight results, but the partial response sample below illustrates the main differences between flight and train results:
Response
<CommandList>
<CheckRouting millis="4">
......
<RouterList>
<Router>
.........
<RequestedLocations>
<Origin>
<Type>city</Type>
<Code>LON</Code>
</Origin>
.........
</RequestedLocations>
<GroupList>
<Group>
<OutwardList>
<Outward>
.........
<SegmentList>
<Segment>
<Origin>
<Type>trainstation</Type>
<Code>EU0</Code>
<SupplierDisplayName>London Euston, Greater London</SupplierDisplayName>
</Origin>
......................
</Segment>
</SegmentList>
</Outward>
</OutwardList>
</Group>
</GroupList>
</Router>
</RouterList>
<Summary>
<Origin>
...........
<StationList>
<Station>
<Name>London Euston, Greater London</Name>
<Code>EU0</Code>
<City>
<Name>London</Name>
<Code>LON</Code>
</City>
</Station>
</StationList>
</Origin>
..............
</Summary>
</CheckRouting>
</CommandList>
Summary of differences:
In the RequestedLocations, the location type may be trainstation. This is in cases where a specific station is requested from the supplier, because a specific station is requested from Travelfusion or the supplier does not support a city-based searching and so individual stations must be requested. In these cases, the Descriptor will be the Travelfusion station code.
In the Segment, the Origin (and Destination) will normally have type trainstation. The code will be the Travelfusion station code if it is resolvable to one of our codes, if not we simply display the returned station name. The origin code of the first segment and the destination code of the last segment will always be Travelfusion station codes.
In the Summary, there is a new element 'StationList'. This lists the relevant stations, with their related cities and the Travelfusion code and name for the station.
List Train Stations
The ListTrainStations returns the trains stations codes as defined on Travelfusion side and the station names and coordinates for a particular rail supplier when <Supplier> element is filled. To obtain the complete Travelfusion stations codes list please omit the <Supplier> entry and add <IsTest> entry set to false. This request should not be performed more often than once per day for each supplier, and infrequently for the full station list since our list does not change that much. It should be accessed during off-peak hours wherever possible (00:00 to 07:00 UK time).
Example of obtaining supplier specific station list.
Request
<CommandList>
<ListTrainStations>
<XmlLoginId>***</XmlLoginId>
<LoginId>***</LoginId>
<Supplier>thetrainline</Supplier>
</ListTrainStations>
</CommandList>
Reponse
<ListTrainStations millis="144">
<LoginId>***</LoginId>
<StationList>
<Station Code="EU0" Name="London Euston" Country="GB" Lat="51.527862" Lon="-0.132956"/>
<Station Code="WA2" Name="London Waterloo" Country="GB" Lat="51.501940" Lon="-0.113880"/>
......
......
</StationList>
</ListTrainStations>
If the <Supplier> element is omitted we output a test reponse:
Request
<CommandList>
<ListTrainStations>
<XmlLoginId>***</XmlLoginId>
<LoginId>***</LoginId>
</ListTrainStations>
</CommandList>
Response
<ListTrainStations millis="0">
<LoginId>**</LoginId>
<StationList>
<Station Data="6letterCode|3letterCode|Country|Lat,Lon|Name"/>
</StationList>
</ListTrainStations>
Because the <IsTest> element is missing and not set to false it gives a short test response to prevent accidental queries that could waste processing time and bandwidth. Please note that in this case the returned data is "|" delimited in order to minimise response size. The test response shows the format of the data returned starting with 6lettercode and then 3lettercode which are Travelfusion codes for the entry, followed by the Country of the station, it's latitude and longitude and finally its name.
Please note that Travelfusion is moving towards 6 letter station codes for the simple reason that we are running out of 3 letter codes. We currently have about 35,000 station codes which will soon exhaust the possibilities of 3 letter alphanumeric codes. Hence, going forward, new 6 letter codes for train station will have to be used. At the time of writing, November 2023, all stations have a 3 letter and 6 letter code. When we run out of 3 letter codes then the 3 letter code entry in the response will show "---" to signify that the station only has a 6 letter code.
To get the full list the following query should be submitted:
Request
<CommandList>
<ListTrainStations>
<XmlLoginId>***</XmlLoginId>
<LoginId>***</LoginId>
<IsTest>false</IsTest>
</ListTrainStations>
</CommandList>
Response
<ListTrainStations millis="144">
<LoginId>***</LoginId>
<StationList>
. . .
<Station Data="GB0EU0|EU0|GB|51.527862,51.527862|London Euston, Greater London"/>
<Station Data="DE0X0F|X0F|DE|50.645378,50.645378|Nieder Ohmen"/>
<Station Data="DE0X0E|X0E|DE|49.656897,49.656897|Nieder Flörsheim-Dalsheim"/>
<Station Data="GB0GM0|GM0|GB|51.701968,51.701968|Great Missenden, Bucks"/>
<Station Data="GB0GM2|GM2|GB|54.436223,54.436223|Grosmont, Nyork"/>
<Station Data="DE0X0B|X0B|DE|51.313052,51.313052|Velbert-Neviges"/>
<Station Data="GB0GM1|GM1|GB|53.563829,53.563829|Grimsby Town, Lincs"/>
. . .
</StationList>
</ListTrainStations>
So for example to make things clear, in the above response, "GBOEU0" and "EU0" refer to the same station, in this case "London Euston".
List Countries Routes
The GetSupplierCountryList return the countries that the train supplier supports. This can also be seen as a retriction to what kind of search locations can be used. Note that although some suppliers might support a particular country they might only have a few stations searchable in that country, to get the specific stations it's best to call ListTrainStations for a closer view.
Example of obtaining specific supplier country list.
Request
<CommandList>
<GetSupplierCountryList>
<XmlLoginId>***</XmlLoginId>
<LoginId>***</LoginId>
<Supplier>eurostar</Supplier>
</GetSupplierCountryList>
</CommandList>
Response
<GetSupplierCountryList millis="2">
<LoginId>***</LoginId>
<CountryList>
<Country>
<CountryCode>BE</CountryCode>
<CountryName>Belgium</CountryName>
</Country>
<Country>
<CountryCode>FR</CountryCode>
<CountryName>France</CountryName>
</Country>
<Country>
<CountryCode>GB</CountryCode>
<CountryName>United Kingdom</CountryName>
</Country>
</CountryList>
</GetSupplierCountryList>
Discount Cards
Most trains supplier support discount cards. Although the specific discount cards and type vary between trains supplier, Travelfusion has unified the process. The discount card types should be submitted in the StartRouting request, one per traveller.
Request
<StartRouting>
<XmlLoginId>***</XmlLoginId>
<LoginId>***</LoginId>
.................
<BookingProfile>
<CustomSupplierParameterList>
<CustomSupplierParameter>
<Supplier>DB</Supplier>
<Name>DiscountType</Name>
<Value>BC25-1</Value>
</CustomSupplierParameter>
<CustomSupplierParameter>
<Supplier>DB</Supplier>
<Name>DiscountType</Name>
<Value>BC50-1</Value>
</CustomSupplierParameter>
</CustomSupplierParameterList>
</BookingProfile>
</StartRouting>