.. meta:: :description: Wired Zak API read guests :keywords: api, pms, zak, kapi, booking, bookings, reservation, reservations, guest, guests Zak API to read/write inventory ******************************* | These APIs allow you to read/write the inventory data of a zak property. .. _wb_yyyyyyyyyyy: ../kapi/introduction.html#authentication .. _rooms: ../kapi/property.html#fetch-rooms .. _rooms types: ../kapi/property.html#fetch-room-types | On each examples `wb_yyyyyyyyyyy`_ is used as **api-key** which is sent as *user*. Fetch symbols ============= | This method will return a list of inventory parameters, useful in order to use these APIs along with a short description. You can check types and meanings of those parameters by clicking on `rmap`_ .. code-block:: html Url: https://kapi.wubook.net/kp/inventory/fetch_symbols | Usage example ------------- Input fields are not necessary. .. tabs:: .. code-tab:: bash curl $ curl --location --request POST 'https://kapi.wubook.net/kp/inventory/fetch_symbols' \ --header 'x-api-key: wb_yyyyyyyyyyy' .. code-tab:: py >>> import requests >>> headers = {'x-api-key':'wb_yyyyyyyyyyy'} >>> response= requests.post('https://kapi.wubook.net/kp/inventory/fetch_symbols', headers = headers, data = data) >>> print(response.text) | Response Example ---------------- .. code-block:: shell {"data": {"m": "MinStay", "M": "MAxStay", .. }} | Fetch rooms availability ============= | This method will return a list of room types IDs that contain availability for the selected date range and the available physical rooms related to the room type. For more informations, check `rooms`_ and `rooms types`_ .. code-block:: html Url: https://kapi.wubook.net/kp/inventory/fetch_rooms_availability | Usage example ------------- | **INPUT** mandatory fields: .. table:: :widths: auto +--------------------------+---------------------+------------+------------------------+ | **Field name** | **Description** | **Type** | **Mandatory** | +==========================+=====================+============+========================+ | *arrival* | starting date | str | yes | +--------------------------+---------------------+------------+------------------------+ | *departure* | departure date | str | yes | +--------------------------+---------------------+------------+------------------------+ .. tabs:: .. code-tab:: bash curl $ curl --location --request POST 'https://kapi.wubook.net/kp/inventory/fetch_rooms_availability' \ --header 'x-api-key: wb_yyyyyyyyyyy' \ --data-urlencode 'arrival=10/10/2023' \ --data-urlencode 'departure=12/10/2023' .. code-tab:: py >>> import requests >>> headers = {'x-api-key':'wb_yyyyyyyyyyy'} >>> data = { >>> 'arrival':'10/10/2023', >>> 'departure': '12/10/2023', >>> } >>> response= requests.post('https://kapi.wubook.net/kp/inventory/fetch_rooms_availability', headers = headers, data = data) >>> print(response.text) | Response Example ---------------- A dictionary will be returned where keys(1,2,3,7 in the example) are the room type ids, availability is the real availability and rooms are the available phisical rooms. In the example, the id "2" has 1 room available and 2 phisical rooms (5, 6). In this case, for the selected period, a reservation was made specifying the room type, but no physical room has been assigned. .. code-block:: shell ${"data":{ "1":{ "availability":8, "rooms":[ 1, 2, 3, 14, 15, 16, 17, 18 ] }, "2":{ "availability":1, "rooms":[ 5, 6 ] }, "3":{ "availability":3, "rooms":[ 7, 8, 9 ] }, "7":{ "availability":0, "rooms":[ ] } } } | Fetch rate values ================= | This method will allow you to fetch values of a given rate. .. code-block:: html Url: https://kapi.wubook.net/kp/inventory/fetch_rate_values ..... Usage example ------------- | **INPUT** mandatory fields: .. table:: :widths: auto +--------------------------+--------------------------------------------------+------------+----------------------------------------+ | **Field name** | **Description** | **Type** | **Mandatory** | +==========================+==================================================+============+========================================+ | *from* | starting date | str | yes | +--------------------------+--------------------------------------------------+------------+----------------------------------------+ | *rate* | rate_id | int | yes | +--------------------------+--------------------------------------------------+------------+----------------------------------------+ | *n* | number of days | int | yes | +--------------------------+--------------------------------------------------+------------+----------------------------------------+ | Let's say you want to fetch values for **rate = 5**, from **10/10/2023 to the next 5 days**. .. tabs:: .. code-tab:: bash curl $ curl --location --request POST 'https://kapi.wubook.net/kp/inventory/fetch_rate_values' \ --header 'x-api-key: wb_yyyyyyyyyyy' \ --data-urlencode 'from=01/01/2023' \ --data-urlencode 'rate=5' \ --data-urlencode 'n=5' .. code-tab:: py >>> import requests >>> headers = {'x-api-key':'wb_yyyyyyyyyyy'} >>> data = { >>> 'from':'10/11/2023', >>> 'rate': 5, >>> 'n': 5 >>> } >>> response= requests.post('https://kapi.wubook.net/kp/inventory/fetch_rate_values', headers = headers, data = data) >>> print(response.text) | Response Example ---------------- A dictionary will be returned where keys(278 in the example) are the product ids and values are lists of dictionaries (one for each day, 5 in this case) If you want to have a closer look at parameters that can be return click `rmap`_ .. code-block:: shell {"data": {"278": [{"p": 1000.0, "m": 1, "M": 1, "mx": ...}, {..}, {..}]}} .. ========================== .. .. Produce uno inventory data .. ========================== .. .. | AAA Need to describe this method. .. .. .. code-block:: html .. .. Url: https://kapi.wubook.net/kp/inventory/produce_uno_inventory_data .. .. Input mandatory fields: .. .. .. table:: .. :widths: auto .. .. +--------------------------+-----------------------------------------------------------------------------------------+ .. | **Field name** Error in "code-block" directive:maximum 1 argument(s) allowed, 11 supplied. | **Description** | .. +==========================+=========================================================================================+ .. | *from* | starting date | .. +--------------------------+-----------------------------------------------------------------------------------------+ .. | *to* | ending date | .. +--------------------------+-----------------------------------------------------------------------------------------+ .. .. | Response-data: *to complete* .. .. .. _123456: ../kapi/introduction.html#authentication .. .. Examples .. -------- .. .. | On each examples `123456`_ is used as **api-key** which is sent as *user*. .. .. curl: .. ..... .. .. code-block:: shell .. .. .. $ curl https://kapi.wubook.net/kp/inventory/produce_uno_inventory_data -u 123456: .. { .. "data": .. [ .. {"from": "dd/mm/yyyy", "to": "dd/mm/yyyy"}, .. ] .. } .. .. .. .. python code: .. ............ .. .. code-block:: python .. .. import requests .. uspw=(123456, None) .. response= requests.post('https://kapi.wubook.net/kp/inventory/produce_uno_inventory_data', {}, auth= uspw) .. print(response.text) .. .. .. ========================== .. .. Produce neb inventory data .. ========================== .. .. | AAA Need to describe this method. .. .. .. code-block:: html .. .. Url: https://kapi.wubook.net/kp/inventory/produce_neb_inventory_data .. .. .. Input mandatory fields: .. .. .. table:: .. :widths: auto .. .. +--------------------------+-----------------------------------------------------------------------------------------+ .. | **Field name** | **Description** | .. +==========================+=========================================================================================+ .. | *from* | starting date | .. +--------------------------+-----------------------------------------------------------------------------------------+ .. | *to* | ending date | .. +--------------------------+-----------------------------------------------------------------------------------------+ .. .. | Response-data: *to complete* .. .. .. _123456: ../kapi/introduction.html#authentication .. .. Examples .. -------- .. .. | On each examples `123456`_ is used as **api-key** which is sent as *user*. .. .. curl: .. ..... .. .. code-block:: shell .. .. $ curl https://kapi.wubook.net/kp/inventory/produce_neb_inventory_data -u 123456: .. { .. "data": .. [ .. {"from": "dd/mm/yyyy", "to": "dd/mm/yyyy"}, .. ] .. } .. .. .. .. .. python code: .. ............ .. .. code-block:: python .. .. import requests .. uspw=(123456, None) .. response= requests.post('https://kapi.wubook.net/kp/inventory/produce_neb_inventory_data', {}, auth= uspw) .. print(response.text) .. .. .. ============================ .. .. Produce fount inventory data .. ============================ .. .. | AAA Need to describe this method. .. | Input mandatory fields: .. .. .. code-block:: html .. .. Url: https://kapi.wubook.net/kp/inventory/produce_fount_inventory_data .. .. .. table:: .. :widths: auto .. .. +--------------------------+-----------------------------------------------------------------------------------------+ .. | **Field name** | **Description** | .. +==========================+=========================================================================================+ .. | *from* | starting date | .. +--------------------------+-----------------------------------------------------------------------------------------+ .. | *oid* | Channel Identifier | .. +--------------------------+-----------------------------------------------------------------------------------------+ .. | to | ending date | .. +--------------------------+-----------------------------------------------------------------------------------------+ .. .. | Response-data: *to complete* .. .. .. _123456: ../kapi/introduction.html#authentication .. .. Examples .. -------- .. .. | On each examples `123456`_ is used as **api-key** which is sent as *user*. .. .. curl: .. ..... .. .. code-block:: shell .. .. $ curl https://kapi.wubook.net/kp/inventory/produce_fount_inventory_data -u 123456: .. { .. "data": .. [ .. {"from": "dd/mm/yyyy", "to": "dd/mm/yyyy", "oid":"x"}, .. ] .. } .. .. .. python code: .. ............ .. .. code-block:: python .. .. import requests .. uspw=(123456, None) .. response= requests.post('https://kapi.wubook.net/kp/inventory/produce_fount_inventory_data', {}, auth= uspw) .. print(response.text) | Write ===== | .. code-block:: html Url: https://kapi.wubook.net/kp/inventory/write ..... .. _rmap: ../kapi/inventory.html#id5 Usage Example ------------- .. table:: :widths: auto +--------------------------+-----------------------------------------------------------------------------------------+ | **Field name** | **Description** | +==========================+=========================================================================================+ | *from* | starting date | +--------------------------+-----------------------------------------------------------------------------------------+ | *rate_id* | rate id | +--------------------------+-----------------------------------------------------------------------------------------+ | *rmap* | `rmap`_ JSON | +--------------------------+-----------------------------------------------------------------------------------------+ .. tabs:: .. code-tab:: bash curl $ curl --location --request POST 'https://kapi.wubook.net/kp/inventory/write' \ --header 'x-api-key: wb_yyyyyyyyyyy' \ --data-urlencode 'from=10/10/2023' \ --data-urlencode 'rate_id=3' \ --data-urlencode 'rmap={"12": [{"p": 50.0}]}' .. code-tab:: py >>> import requests >>> import json >>> headers = { 'x-api-key': 'wb_yyyyyyyyyyy' } >>> dfrom = '10/10/2023' >>> rate_id = 3 >>> rmap = {'12': [{'p': 50}]} >>> rmap = json.dumps(rmap) >>> data = { >>> 'rate_id': rate_id, >>> 'from': dfrom, >>> 'rmap': rmap, >>> } >>> response = requests.post('https://kapi.wubook.net/kp/inventory/write', data=data, headers=headers) >>> print(response.text) | RMAP ---- Rmap is an object of the form: .. code-block:: shell rmap = {'3':[{'m': 1, 'M': 7, 'ma': 2 ..}, {}, {}] | Where the first number represents the **zak_product_id** (see fetch_producsts) each { } represents a single day. So the first { } represents the day indicated by **from** parameter and so on so forth. .. table:: :widths: auto +--------------------------+----------------------------+-------------------------------------------------------------+---------------+---------------------------------+ | **Field name** | **Extended Filed name** | **Description** | **Type** | **Default Restriction Values** | +==========================+============================+=============================================================+===============+=================================+ | *m* | MinStay | Minimum number of nights for which a stay is possible | integer | 1 | +--------------------------+----------------------------+-------------------------------------------------------------+---------------+---------------------------------+ | *M* | MaxStay | Maximum number of nights for which a stay is possible | integer | 31 | +--------------------------+----------------------------+-------------------------------------------------------------+---------------+---------------------------------+ | *ma* | MinStayArrival | As MinStay, but depending on the arrival date | integer | 1 | +--------------------------+----------------------------+-------------------------------------------------------------+---------------+---------------------------------+ | *Ma* | MaxStayArrival | As MaxStay, but depending on the arrival date | integer | 31 | +--------------------------+----------------------------+-------------------------------------------------------------+---------------+---------------------------------+ | *ni* | NoCheckin | Check-ins cannot be performed on this date | boolean (0,1) | 0 | +--------------------------+----------------------------+-------------------------------------------------------------+---------------+---------------------------------+ | *no* | NoCheckout | Check-outs cannot be performed on this date | boolean (0,1) | 0 | +--------------------------+----------------------------+-------------------------------------------------------------+---------------+---------------------------------+ | *c* | Closure | On this date the sale is closed | boolean (0,1) | 0 | +--------------------------+----------------------------+-------------------------------------------------------------+---------------+---------------------------------+ | *nt* | NoOta | It is not possible to make reservations from ota | boolean (0,1) | 0 | +--------------------------+----------------------------+-------------------------------------------------------------+---------------+---------------------------------+ | *mx* | MinAdvance | This value indicates the minimum advance to book (hours) | integer | 0 | +--------------------------+----------------------------+-------------------------------------------------------------+---------------+---------------------------------+ | *Mx* | MaxAdvance | This value indicates the max advance to book | integer | 365x3 | +--------------------------+----------------------------+-------------------------------------------------------------+---------------+---------------------------------+ | *o* | Allowed Overbookings | Permission to overbook (negative availability) | boolean (0,1) | 0 | +--------------------------+----------------------------+-------------------------------------------------------------+---------------+---------------------------------+ | *l* | Maximum OTA reservations | Maximum amount of OTA reservations | integer | 0 | +--------------------------+----------------------------+-------------------------------------------------------------+---------------+---------------------------------+ | *p* | Price | Price | float | X | +--------------------------+----------------------------+-------------------------------------------------------------+---------------+---------------------------------+ | *a* | Availability | Availability | integer | X | +--------------------------+----------------------------+-------------------------------------------------------------+---------------+---------------------------------+