.. meta:: :description: Wubook Fount :keywords: channel manager, wubook fount, API .. toctree:: :maxdepth: 1 WooDoo Fount Price and Availability *********************************** **How does it work?** WooDoo Fount allows you to query WuBook servers in order to gain access to prices and availabilities of our properties. You must specify a filter, identifying a set or properties to be queried and a range of dates. The filter is usually a **property code** or a list of property codes. .. warning:: To use this feature, you need to subscribe to WooDoo Online Reception or to WooDoo Whitelabel Standard package Response Anatomy ================ The response of those POSTs are always the same: a JSON encoded structure like this one: .. code-block:: python { "warnings": "", "results": PricesAndAvailability, "error": "" } The warnings and error values are easy to understand. The results object is not difficult, but requires few lines. First of all, it's an object: the **keys** of the objects are the property identifier codes. The **values** of the objects are simple structures, containing a key/value set where key IS occupancy and value IS average price. Depending on your query parameters, the PricesAndAvailability object can change. WuBook is able to return you two types of results: Compact or Exploded. :This is an example for **Compact** Result: .. code-block:: html {123: {1: 10, 2: 20}} and means that, for the required dates, the property 123 has a single room and a double room available and the average prices of the rooms are 10 and 20. :So, Compact Result is: .. code-block:: html {lcode1: {occupancy1: averagePrice1, ...., occupancyN: averagePriceN}} :This is an example of **Exploded** Result: .. code-block:: html {123: {1: {100: 10, 101: 12}, 2: {300: 20}} Which is way more detailed. We also return the IDs of the available rooms. The previous data means that the property 123 has two single rooms available (with id= 100 and id= 101). For every single room, the average price is returned (10, 12). In the same way, the property 123 has 1 double room availabile (with id= 300) and its average price, for the selected dates, is 20. If you want details about rooms, accessing names and descriptions, you can use the WuBook Fount Rooms feature. Now that the results have been explained, let's describe how you have to POST. Server2Server profile ===================== Just issue a POST to the following `url `_. You must post a unique parameter: **params**. The content of this parameter is a JSON encoded structure. - **A property filter**, allowing you to select the properties you want to check - **dfrom**: arrival date - **dto**: departure date - **origin**: for Fount Partners. Fount partners should always specify their origin code. Optional, default value= None - **compact**: 0 (zero) or 1 (one). This allows you to have a Compact or an Exploded return, as previously explained. Optional, default val= 1 About Origin: some property can be available. However, they can disable the reselling activities on your site and, if you specify your origin code, we will consider their preferences. For example, if a property has disabled the resellting activity for your Site and you specify your origin code, we will return availability= 0. That's because the hotelier **does not want** to sell his rooms on your site and, so, he will not pay relative commissions. If you don't use your origin code, you can produce reservations for hotelier that **will not pay fees**. .. warning:: All the POST calls operations are managed via SERVER to SERVER technology: it means that you *have to be under Wubook domain* in order for them to work. Property filter: an explicit list of properties. .. tabs:: .. code-tab:: javascript curl curl -X POST 'https://wubook.net/wbkd/fount/json' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: cross-site' --data-raw $'{"lcodes":["1213394817"], "dfrom":"23/09/2023", "dto":"25/09/2023"}' .. code-tab:: javascript fetch('https://wubook.net/wbkd/fount/json', { method: 'POST', headers: { 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'cross-site', 'content-type': 'application/x-www-form-urlencoded' }, body: '{"lcodes":["1213394817"], "dfrom":"23/09/2023", "dto":"25/09/2023"}' }); .. code-tab:: py import requests headers = { 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'cross-site', 'content-type': 'application/x-www-form-urlencoded', } data = '{"lcodes":["1213394817"], "dfrom":"23/09/2023", "dto":"25/09/2023"}' response = requests.post('https://wubook.net/wbkd/fount/json', headers=headers, data=data) WuBook Javascript Library ========================= If you use WuBook Fount for a unique property, you can be interested on the method: WuBook.fount(). This is just a reminder. Check the full documentation at :ref:`jslib`. The method accepts 2 parameters: params and cback. The first one contains a simple struct: {dfrom: '23/09/2022', dto: '25/09/2022'}, while the second one is a simple callback. :Example: .. code-block:: javascript var params= {dfrom: '23/09/2022', dto: '25/09/2022'}; WuBook= new _WuBook(123); WuBook.fount(params, function(data) {console.log(data)}); Good luck and good job!