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 -H "x-api-key:123456" https://kapi.wubook.net/kp/inventory/fetch_symbols
>>> 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)
Fetch rate values¶
Url: https://kapi.wubook.net/kp/inventory/fetch_rate_values
Usage example¶
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.
$ 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
>>> 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
{"data": {"278": [{"p": 1000.0, "m": 1, "M": 1, "mx": ...}, {..}, {..}]}}
Write¶
This is a Premium API If you want to know more about our system authentication click hereUrl: https://kapi.wubook.net/kp/inventory/write
Usage Example¶
Field name |
Description |
---|---|
from |
starting date |
rate_id |
rate id |
rmap |
rmap JSON |
python code:¶
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:
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 |