Dynamic Filters and Filtering
The GetHotelResponse and GetFlightsResponse will contain an element called filters, this element is a list of the filter elements that represent dynamic filters calculated for the specific request, these filters are calculated using the data from the response.
a dynamic filter contains the following attributes:
code: Identifier of the filter.
type: Indicates the type of information that this filter handles, the available types are:
number: the recommended representation is a slider, the number filters contains two more attributes (max, min) to indicate the maximum and minimum value of the slider. When a value is already selected the element contains an additional attribute (selectedValues) to indicate it.
enumeration: the recommended representation is a checkbox per value. Each value has the following attributes:
selected: indicates if this value is selected.
count: the number of occurrences of this filter value in the searched data.
displayName: the Travelfusion suggested display name for the value.
string: the recommended representation is a text box, when a value has already been entered, the element contains an additional attribute (selectedValues) to indicate it.
(max): optional, explained previously.
(min): optional, explained previously.
(selectedValues): optional, explained previously.
(currency): optional, this attribute appears in the filters that include prices, to indicate the currency of the price. To obtain the prices dynamic filters in an specific currency, the currency element must be submitted on its request.
IMPORTANT: It is important that the client is able to handle dynamic filters automatically. Ideally displaying them all to the user generically such that if a new filter is added, it will automatically be shown. However if some development work is needed for each filter (such as translation), then it is important to at least detect the presence of a new filter and alert your team to it, so that the relevant work can be done and it can be utilised in your UI.
Travelfusion reserves it rights to include new filters or remove them from the API responses without previous notice.
Various filters can be applied to the results, of a GetHotelRequest or GetFlightsRequest, by submitting the filters element with a list of filter elements as below. The various available filters are returned as dynamic filters in the responses, so that they can be generically extracted and displayed to the user. Multiple filters of the same type can be submitted - e.g. to receive offers for different product types (plane and train).
a filter contain the following attributes:
code: Identifier of the filter, should be the same as the dynamic filter
(currency): optional, must be submitted for price filters