Zak API to read/write inventory
Fetch symbols
Url: https://kapi.wubook.net/kp/inventory/fetch_symbols
Usage example
Input fields are not necessary.
$ curl --location --request POST 'https://kapi.wubook.net/kp/inventory/fetch_symbols' \
--header 'x-api-key: wb_yyyyyyyyyyy'
>>> 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
{"data": {"m": "MinStay", "M": "MAxStay", .. }}
Fetch rooms availability
Url: https://kapi.wubook.net/kp/inventory/fetch_rooms_availability
Usage example
Field name |
Description |
Type |
Mandatory |
---|---|---|---|
arrival |
starting date |
str |
yes |
departure |
departure date |
str |
yes |
$ 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'
>>> 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.
${"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
Url: https://kapi.wubook.net/kp/inventory/fetch_rate_values
Usage example
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.
$ 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'
>>> 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
{"data": {"278": [{"p": 1000.0, "m": 1, "M": 1, "mx": ...}, {..}, {..}]}}
Write
Url: https://kapi.wubook.net/kp/inventory/write
Usage Example
Field name |
Description |
---|---|
from |
starting date |
rate_id |
rate id |
rmap |
rmap JSON |
$ 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}]}'
>>> 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:
rmap = {'3':[{'m': 1, 'M': 7, 'ma': 2 ..}, {}, {}]
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 |