Trains

here

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, some example XML is given below for a search from London to Manchester:

Request

<CommandList>
<StartRouting>
<XmlLoginId>HJHH3K9HTYHJ45T0</XmlLoginId>
<LoginId>HJHH3K9HTYHJ45T0</LoginId>
<Mode>Plane</Mode>
<Origin>
      <Descriptor>LON</Descriptor>
      <Type>citycode</Type>
</Origin>
<Destination>
      <Descriptor>MAN</Descriptor>
      <Type>citycode</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>
</StartRouting>
</CommandList>

Various types of location can be specified in the request:

airportcode
A small radius should be specified (around 5000m) and stations within this distance from the airport specified will then be searched.
citycode The radius will be ignored and the main stations for the specified city will be searched 
airportgroup The main stations for the specified city will be searched
trainstationcode 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

Response

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:

<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>EUS</Code>
                      <SupplierDisplayName>London Euston, Gtlon</SupplierDisplayName>
                    </Origin>
......................
                  </Segment>
                </SegmentList>
              </Outward>
            </OutwardList>
          </Group>
        </GroupList>
      </Router>
    </RouterList>
    <Summary>
      <Origin>
...........
        <StationList>
          <Station>
            <Name>London Euston, Gtlon</Name>
            <Code>EUS</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.
  • 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 Trains Stations 

The ListTrainStations returns the trains stations codes as defined on travelfusion side and the station names and coordinates for a particular rail supplier.
This request should not be performed more often than once per day for each supplier. It should be accessed during off-peak hours wherever possible (00:00 to 07:00 UK time). 

<CommandList>
  <ListTrainStations>
    <XmlLoginId></XmlLoginId>
    <LoginId></LoginId>
    <Supplier>thetrainline</Supplier>
  </ListTrainStations>
</CommandList>

The ListTrainStations response format :

<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>


Discount Cards

 Most trains supplier support discount cards. Although the spefic 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.

<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>

Fast Trains Only Filter

Trains supplier results can be queried for only values over a given speed. 
The default value for the minimum speed is 75.0 k/h if none is specified. The default value can be overriden per branch or simply per request (for example in this case 50km/h).

<CustomSupplierParameter>
      <Name>TrainsFilterType</Name>
      <Value>FastOnly</Value>
   </CustomSupplierParameter>
   <CustomSupplierParameter>
      <Name>TrainsFilterMinimumSpeed</Name>
      <Value>50</Value>
</CustomSupplierParameter>

or sumbitted for a single supplier.
<CustomSupplierParameter>
      <Name>TrainsFilterType</Name>
      <Supplier>idtgv</Supplier>
      <Value>FastOnly</Value>
   </CustomSupplierParameter>
   <CustomSupplierParameter>
      <Supplier>idtgv</Supplier>
      <Name>TrainsFilterMinimumSpeed</Name>
      <Value>50</Value>
</CustomSupplierParameter>

Comments