.. 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. .. _123456: ../kapi/introduction.html#authentication | On each examples `123456`_ 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 -H "x-api-key:123456" https://kapi.wubook.net/kp/inventory/fetch_symbols .. code-tab:: py >>> import requests >>> headers = {'x-api-key':'123456'} >>> 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 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** | +==========================+=========================================================================================+ | *from* | starting date | +--------------------------+-----------------------------------------------------------------------------------------+ | *rate* | rate_id | +--------------------------+-----------------------------------------------------------------------------------------+ | *n* | number of days | +--------------------------+-----------------------------------------------------------------------------------------+ | Let's say you want to fetch values for **rate = 5**, from **10/10/2020 to the next 5 days**. .. tabs:: .. code-tab:: bash curl $ curl -H "x-api-key:123456" -d 'from=10/10/2020' -d 'rate=5' -d 'n=4' https://kapi.wubook.net/kp/inventory/fetch_rate_values .. code-tab:: py >>> import requests >>> headers = {'x-api-key':'123456'} >>> data = { >>> 'from':'10/11/2020', >>> 'rate': 4, >>> '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 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 ===== .. include:: ../kapi/pro_api_info.rst | .. 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 | +--------------------------+-----------------------------------------------------------------------------------------+ python code: ............ .. code-block:: python import requests import json headers = { 'x-api-key': '123456', 'x-api-provider-key': '654321' } rmap = json.dumps(rmap) dfrom = '12/12/2020' rate = 16817 data = { 'rate_id': rate, 'from': dfrom, 'rmap': rmap } response = requests.post('https://kapi.wubook.net/kp/inventory/write', data=data, headers=headers) | 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 | +--------------------------+----------------------------+-------------------------------------------------------------+---------------+---------------------------------+