Zak API to read/write reservations details¶
A Reservation¶
A reservation is a data structure composed of the following fields:
Field name |
Description |
---|---|
id |
Id of the reservation |
rcode |
Reservation code of the form XY-0001 |
rooms |
A list of rooms |
status |
Status of the reservation |
price |
A data structure containing information regarding the price |
payment |
A data structure containing information regarding the payment |
board |
type of board of the reservation |
agency |
id of the agency through which the reservation has been made |
booker |
id of the booker |
corporate |
id of the corporate through which the reservation has been made |
created |
creation date of the reservation |
A room is structured as following:
Field name |
Description |
---|---|
dfrom |
Starting date |
dto |
Ending date |
id_zak_room |
id of the room |
id_zak_room_type |
id of the room type |
customers |
A data structure containing the ids of the customers related to the reservation |
occupancy |
A data structure containing information regarding occupancy |
Fetch one reservation¶
This is a Premium API If you want to know more about our system authentication click hereUrl: https://kapi.wubook.net/kp/reservations/fetch_one_reservation
Usage example¶
At least one of the following parameters is required:
Field name |
Description |
---|---|
rsrvid |
reservation id |
hcode |
reservation code of the form (XY-0001) |
$ curl -H "x-api-key:123456" https://kapi.wubook.net/kp/reservations/fetch_one_reservation
>>> import requests
>>> headers = {'x-api-key':'123456', 'x-provider-key':654321}
>>> response= requests.post('https://kapi.wubook.net/kp/reservations/fetch_one_reservation', headers = headers, data = data)
>>> print(response.text)
Response Example¶
$ curl https://kapi.wubook.net/kapi/reservations -u 123456: -X POST \
-d rsrvid=47
{'agency': None,
'board': 'nb',
'booker': 534,
'corporate': None,
'created': '22/01/2021',
'id': 47,
'id_human': 'PP-0004',
'payment': {'amount': 0.0, 'currency': 'EUR'},
'price': {'amount': 1495.0, 'currency': 'EUR'},
'rooms': [{'customers': [{'id': 534}, {'id': 535}],
'dfrom': '23/01/2021',
'dto': '30/01/2021',
'id_zak_room': 246,
'id_zak_room_type': 2,
'occupancy': {'adults': 2,
'babies': 0,
'children': 0,
'teens': 0}}],
'status': 'confirmed'}
Fetch reservations¶
This is a Premium API If you want to know more about our system authentication click hereUrl: https://kapi.wubook.net/kp/reservations/fetch_reservations
Usage example¶
Input fields are not necessary, nevertheless a data structure containing filtering options can be provided
Type of filters |
Description |
---|---|
created |
Reservations created in a range of dates |
arrival |
Reservation with arrival date in a range of dates |
departure |
Reservation with departure date in a range of dates |
pager |
Paging options - Limit can be a value in [8, 16, 32, 64], offset can be any integer |
${'filters':{
'created': {'from': '10/10/2020', 'to':'01/02/2021'},
'arrival': {'from': '17/12/2020', 'to': '11/01/2021'},
'departure': {'from': '10/02/2021', 'to': '12/03/2021'},
'pager': {'limit': 8, 'offset': 0}
}
}
filters must be passed as JSON.
$ curl -H "x-api-key:123456" https://kapi.wubook.net/kp/reservations/fetch_reservations
>>> import requests
>>> headers = {'x-api-key':'123456', 'x-provider-key':654321}
>>> response= requests.post('https://kapi.wubook.net/kp/reservations/fetch_reservations', headers = headers, data = data)
>>> print(response.text)
Response example¶
This API returns a list of reservations.
Meal¶
A meal is a data structure having the following fields
Field name |
Description |
subf-ields |
---|---|---|
id |
id of the meal |
|
dates |
structure containing dates information |
day, created |
meal_info |
structure containing meal information |
mnumber, mtype, times |
price |
structure containing costs information |
amount, currency, discount, total, vat, vat_rate |
field |
Type |
Description |
day |
date (dd/mm/yyyy) |
day on which the meal was eaten |
created |
date (dd/mm/yyyy) |
creation date on Zak |
mnumber |
integer |
number of meals |
mtype |
string (“b”, “l” or “d” ) |
Breakfast, lunch or dinner |
times |
integer |
number of repetitions for this meal |
amount |
float |
amount |
currency |
string |
currency of the amount |
discount |
float |
discount |
total |
float |
total |
vat |
float |
vat |
vat_rate |
int |
vat percentage |
Meal example¶
${"data":
{
"id": 34,
"dates": {
"created": "27/01/2021",
"day": "25/01/2021"
},
"meal_info": {
"mnumber": 1,
"mtype": "l",
"times": 1
},
"price": {
"amount": 19.0,
"currency": "EUR",
"discount": 0.0,
"total": 19.0,
"vat": 0.0,
"vat_rate": 0
}
},
}
Get Meals¶
This is a Premium API If you want to know more about our system authentication click hereUrl: https://kapi.wubook.net/kp/reservations/get_meals
Usage example¶
Only reservation id is required to use this API.
$ curl -L -X POST 'https://kapi.wubook.net/kp/reservations/get_meals' -H 'x-api-key: 123456' -H 'x-api-provider-key: 654321' -d 'rsrvid=47'
>>> import requests
>>> headers = {'x-api-key':'123456', 'x-provider-key':654321}
>>> data = {'rsrvid': 1}
>>> response= requests.post('https://kapi.wubook.net/kp/reservations/get_meals', headers = headers, data = data)
>>> print(response.text)
Add Meal¶
This is a Premium API If you want to know more about our system authentication click hereUrl: https://kapi.wubook.net/kp/reservations/add_meal
Usage example¶
To use this API one must provide several different parameters
Field |
Description |
Type |
Sub-fields |
---|---|---|---|
rsrivd |
resrvation id |
int |
|
meal |
data structure |
JSON |
price, mtype, mnumber, times, day, rooms, custs |
$ curl -L -X POST 'https://kapi.wubook.net/kp/reservations/add_meal' -H 'x-api-key: 123456' -H 'x-api-provider-key: 654321' -d 'rsrvid=47' -d 'meal'='{}'
>>> import requests
>>> import json
>>> headers = {'x-api-key':'123456', 'x-provider-key':654321}
>>> meal = {'theconfig':mealconfig}
>>> json.dumps(meal)
>>> data = {'rsrvid': 1, 'meal': meal}
>>> response= requests.post('https://kapi.wubook.net/kp/reservations/add_meal', headers = headers, data = data)
>>> print(response.text)
Delete Meal¶
Url: https://kapi.wubook.net/kp/reservations/del_meal
Usage example¶
To use this API only two parameters are mandatory: reservation id, namely rsrvid, and the meal id, fmid.
$ curl -L -X POST 'https://kapi.wubook.net/kp/reservations/del_meal' -H 'x-api-key: 123456' -H 'x-api-provider-key: 654321' -d 'rsrvid=47' -d 'fmid=1'
>>> import requests
>>> headers = {'x-api-key':'123456', 'x-provider-key':'654321'}
>>> data = {'rsrvid': 1, 'fmid':1}
>>> response= requests.post('https://kapi.wubook.net/kp/reservations/del_meal', headers = headers, data = data)
>>> print(response.text)