Hotel API Specification June 2012 > Hotel Search Example XML
Hotel Filter, Sort and Paging Example XML
Sorting
See the specification for the various sorting criteria available. Most commonly a user will just sort by one criterion, in which case it should be submitted with value '1.0' and the others should be omitted.
If the user decides to sort by multiple criteria, such as star-rating and price, where price is, say, twice as important as star-rating, the following XML should be submitted:
Note, the token attribute must be set to a valid token, and the sid must be set to that returned in the previous search.
<GetHotelsRequest sid="******" token="******" xmlns="http://www.travelfusion.com/xml/api/simple">
<rankingParameters>
<priceWeight>1.0</priceWeight>
<starRatingWeight>0.5</starRatingWeight>
</rankingParameters>
</GetHotelsRequest>
Filtering
See the specification for the various filtering criteria available. If the user decides to filter the results to a specific star-rating and a max price of 1000 GBP, the following XML should be submitted:
Note, the token attribute must be set to a valid token, and the sid must be set to that returned in the previous search.
<GetHotelsRequest sid="******" token="******" xmlns="http://www.travelfusion.com/xml/api/simple">
<filters>
<filter code="priceMax" currency="GBP">1000</filter>
<filter code="stars">3</filter>
</filters>
</GetHotelsRequest>
Note that all the filters that are available to the user are specified in the search response (see response here for more details). This means that in principle, no specific coding is needed for the various filters and they can be generically parsed and displayed to the user for generic selection/ submission.
Paging
If the user decides to look at page 2 of the results, the following XML should be submitted:
Note, the token attribute must be set to a valid token, and the sid must be set to that returned in the previous search.
<GetHotelsRequest sid="******" token="******" xmlns="http://www.travelfusion.com/xml/api/simple">
<paging>
<pageNumber>2</pageNumber>
</paging>
</GetHotelsRequest>