Flight API Specification
API Commands Available:
Please remember to read the connection guide which explains how to connect to the service and submit an XML request.
<!-- Submit only 1 of the following location identifiers -->
<coordinate lat="0.34234" lon="65.283"/>
<to>.... same as 'from' above.....</to>
<outDate>2011-06-16</outDate> <!-- outward date -->
<returnDate>2011-07-20</returnDate> <!-- (Optional) return date -->
<ages> <!-- age for each passenger -->
<bagsToCheckin>1</bagsToCheckin> <!-- (Optional) The value cannot be higher than the number of passengers. Indicates how many passengers are checking in a bag -->
<currency>GBP</currency> <!-- defines the currency in which all results should be returned. If omitted, the currency will be that returned by the supplier -->
<!-- ‘supplierConnections’ is the number of data connections to suppliers, ‘completeConnections’ indicates how many supplier have responded so far, ‘totalResults' is the number of bookable offers that have been found so far -->
<resultInfo completeConnections="51" supplierConnections="51" suppliers="8" totalResults="225">
<supplier name="easyjet" completeConnections="15" supplierConnections="21" totalResults="100"/>
<supplier name="flybe" completeConnections="12" supplierConnections="30" totalResults="125"/>
<!-- systemInfo: 'suppliers' gives the total number of suppliers that are active for your account. -->
<billingPrice currency="EUR" luggageCharge="26.00">61.99</billingPrice> <!-- The billingPrice is the exact price in the currency that will be billed. The luggageCharge will only be included if 'bagsToCheckin' is specified in the request and has value great than 0 -->
<price currency="GBP" luggageCharge="26.00">41.99</price> <!-- This is the billing price converted to the requested currency using TF's conversion rates. The luggageCharge will only be included if 'bagsToCheckin' is specified in the request and has value great than 0 -->
<out orig="LGW" dest="MAD" dep="2011-06-16 08:25" arr="2011-06-16 21:21" changes="1" duration="11:56">
<segment dest="FRA" operator="British Airways">
<segment dest="MAD" operator="Norwegian">
-------- Similar format to outward ---------
<out orig="LTN" dest="MAD" dep=" 2011-06-16 09:25" arr="2011-06-16 12:21" changes="0" duration="1:56">
<segment dest="MAD" operator="Easyjet">
-------- Similar format to outward ---------
IMPORTANT: The above call will always respond immediately, and will return the best offers received from suppliers so far (therefore the first response will contain no offers at all). If the completeConnections is less than the supplierConnections, then the request below can be submitted to receive any new offers that have been returned by the various suppliers. You should not submit this 'polling' request more often that every 3 seconds, and you should always stop polling when all results have been returned or when a certain timeout is reached (e.g. after 1 minute). Polling only applies to requests that depend upon live connections to 3rd parties and therefore are 'slow'. This currently is only 'GetFlightsRequest' and 'GetHotelsRequest'
By default, the best 10 offers are returned. This can be changed by submitting the ‘paging’ element described below.
The sid must be submitted when to modifying the results of a previous search, for example to request a different page of results, or adjust the number of results per page:
<pageNumber>2</pageNumber> <!-- Requests the second page of results -->
<offersPerPage>5</offersPerPage> <!-- Specifies the number of offers on each page -->
Travelfusion may not support 'page-skipping'. i.e. you will not be able to view page 2 without viewing page 1 first. The end user should only be offered 'next' and 'previous' buttons, not a list of page numbers.
Ranking of results
The sid is used to re-rank the results of an existing search.
Each of the parameters is optional. They initially have default values as above. Weights must be between 0 and 1 and indicate the relative importance of each feature of the offers. Offers are then ranked according to these weights and features.
The information of how to do filtering can be found here.
Any of the 3 requests above (polling, paging and ranking) can be combined into a single request where needed. For example, to launch a new search and set the timeWeight to 0 and priceWeight to 1, the following could be submitted:
Note that all parameters and paging is remembered in the session, so if the request below is then submitted, the results to the above search will be re-ranked, considering the new timeWeight (but preserving the previously specified priceWeight), and the 2nd page of 5 offers will be returned.
The API has been designed to represent the pages of a typical mobile or widget user-interface, and the behaviour of a typical user – i.e. submitting a search and then paging or filtering the results based on various criteria.
It supports some advanced weighted ranking functions that could be offered to the user in many simple formats or hidden completely. These are designed to help identify a very small set of the most useful results from a very large set of options, without the user needing to page through hundreds of offers and compare them by memory.
Booking (Get Booking Ids For Offer)
In order to book a flight offer, you will first need to obtain the 'booking ids' for the offer. You can do this as follows:
These 5 ids can then be submitted to STEP 4 of our booking API here.