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 |
expiration_date |
In case status is option/offer, such field contains the optional expiring date |
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 |
---|---|
id |
reservation id |
hcode |
reservation code of the form (XY-0001) |
$ curl --location --request POST 'https://kapi.wubook.net/kp/reservations/fetch_one_reservation' \
--header 'x-api-key: wb_yyyyyyyyyyy' \
--header 'x-api-provider-key: kp_xxxxxxxxx' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'rcode=BS-0003'
>>> import requests
>>> headers = {'x-api-key':'123456', 'x-api-provider-key':654321}
>>> response= requests.post('https://kapi.wubook.net/kp/reservations/fetch_one_reservation', headers = headers, data = data)
>>> print(response.text)
Response Example
$
{
"data": {
"id": 1758,
"id_human": "BS-0003",
"booker": 90706,
"status": "Confirmed",
"board": "nb",
"created": "12/11/2021",
"agency": null,
"corporate": null,
"price": {
"rooms": {
"amount": 7195.909090909092,
"vat": 719.5909090909087,
"total": 7915.5,
"discount": 0,
"currency": "EUR"
},
"extras": {
"amount": 0,
"vat": 0,
"total": 0,
"discount": 0
},
"meals": {
"amount": 0,
"vat": 0,
"total": 0,
"discount": 0
},
"total": 7951.5
},
"payment": {
"amount": 0,
"currency": "EUR"
},
"taxes": {
"rsrv_tax": {
"currency": "EUR",
"amount": 0,
"vat": 0,
"vat_rate": 0,
"total": 0,
"discount": 0
},
"currency": "EUR",
"room_tax": {
"amount": 36,
"total": 36,
"vat": 0,
"vat_rate": 0
},
"total": 36
},
"rooms": [
{
"id_zak_room": null,
"id_zak_room_type": 1,
"dfrom": "12/11/2021",
"dto": "15/11/2021",
"occupancy": {
"adults": 2,
"teens": 0,
"children": 0,
"babies": 0
},
"customers": [
{
"arrived": "15/11/2021",
"departed": "15/11/2021",
"id": 90706
}
]
},
{
"id_zak_room": null,
"id_zak_room_type": 7,
"dfrom": "12/11/2021",
"dto": "15/11/2021",
"occupancy": {
"adults": 4,
"teens": 0,
"children": 0,
"babies": 0
},
"customers": []
},
{
"id_zak_room": null,
"id_zak_room_type": 3,
"dfrom": "13/11/2021",
"dto": "18/11/2021",
"occupancy": {
"adults": 2,
"teens": 0,
"children": 0,
"babies": 0
},
"customers": []
},
{
"id_zak_room": null,
"id_zak_room_type": 3,
"dfrom": "13/11/2021",
"dto": "18/11/2021",
"occupancy": {
"adults": 2,
"teens": 0,
"children": 0,
"babies": 0
},
"customers": []
}
]
}
}
Create a reservation
Url: https://kapi.wubook.net/kp/reservations/new
Usage example
The information is sent with an unique parameter, containing a json structure:
Field name |
Description |
---|---|
params |
Json Structure |
The Json Structure has the following mandatory fields:
Field name |
Description |
---|---|
arrival |
Arrival (european format 21/12/2121) |
depature |
Departure (european format 21/12/2121) |
customer |
As an object: {‘name’: Name, ‘surname’: surname} (and optionally email and phone) |
It is also mandatory to specify rooms and/or products. At least specify rooms or products (specifying both still possible):
Field name |
Description |
---|---|
rooms |
A list of rooms (each room being a dict-like object) |
products |
A list of products (each product being a dict-like object) |
About rooms: you can specify the room type, the phisical room or both information.
$ curl --location --request POST 'https://192.168.1.225:11512/kp/reservations/new' \
--header 'x-api-key: wb_90dc1e88-2f0c-11eb-acd8-1150d7962d48' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'params={"arrival": "10/10/2022", "departure": "11/10/2022", "customer": {"name": "Name", "surname": "Surname"}, "rooms": [{"room": 159, "room_type": 107, "price": 100, "currency": "EUR"}], "products": [{"product": 329, "price": 101, "currency": "EUR"}]}'
>>> import requests
>>> import json
>>> headers = {'x-api-key':'123456'}
>>> room= {'room': 123, 'room_type': 321, 'price': 100, 'currency': 'EUR'}
>>> rooms= [room]
>>> prod= {'product': 999, 'price': 110, 'currency': 'EUR'}
>>> prods= [prod]
>>> cust= {'name': 'Bat', 'surname': 'Man', 'email': 'bat@gotham.us', 'phone': '3333'}
>>> arv= '21/10/2021'
>>> dep= '22/10/2021'
>>> params= {'arrival': arv, 'departure': dep, 'customer': cust, 'rooms': rooms, 'products': prods}
>>> data= {'params': json.dumps(params)}
>>> response= requests.post('https://kapi.wubook.net/kp/reservations/new', headers = headers, data = data)
>>> print(response.text)
Response Example
$
{
"data": {
"id": XY-0001,
}
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 --location --request POST 'https://kapi.wubook.net/kp/reservations/fetch_reservations' \
--header 'x-api-key: wb_xxxxxxxxxxxxx' \
--header 'x-api-provider-key: kp_yyyyyyyyyyyy' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'filters={"created": {"from": "20/08/2021", "to": "30/09/2021"}, "arrival": {"from": "", "to": ""}}'
>>> import requests
>>> headers = {'x-api-key':'123456', 'x-api-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.
Fetch today 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_today_reservations
Usage example
Input fields are not necessary.
$ curl --location --request POST 'https://kapi.wubook.net/kp/reservations/fetch_today_reservations' \
--header 'x-api-key: wb_yyyyyyyyyyy' \
--header 'x-api-provider-key: kp_xxxxxxxxx'
>>> import requests
>>> headers = {'x-api-key':'123456', 'x-api-provider-key':654321}
>>> response= requests.post('https://kapi.wubook.net/kp/reservations/fetch_reservations', headers = headers)
>>> print(response.text)
Checkin/out
This section describes methods to execute check-in / check-out actions on a given reservation.
Url: https://kapi.wubook.net/kp/reservations/do_checkin
Url: https://kapi.wubook.net/kp/reservations/do_checkout
Usage example
Following parameters can / must be used in order to use this call
Field name |
Description |
Mandatory |
---|---|---|
reservation_id |
reservation id |
yes, if not human_code |
human_code |
reservation code of the form (XY-0001) |
yes, if not id |
room_customer_ids |
list of reservation room customers id’s |
No |
all |
str to check-in(out) all the customers in a reservation (any string is ok, ‘x’ e.g ) |
No |
$ curl --location --request POST 'https://kapi.wubook.net/kp/reservations/do_checkin' \
--header 'x-api-key: wb_yyyyyyyyyyy' \
--header 'x-api-provider-key: kp_xxxxxxxxx'
--data-urlencode 'reservation_ireservation_id=599' \
--data-urlencode 'all='\''true'\
>>> import requests
>>> headers = {'x-api-key':'123456', 'x-api-provider-key':'654321'}
>>> body = {'reservation_id':'123', 'all':'x'}
>>> response= requests.post('https://kapi.wubook.net/kp/reservations/do_checkin', headers = headers, data = body)
>>> print(response.text)
Response example
${"data": {
"success": "true"
}
${ "error": "the error" }
Undo Checkin/out
This section describes methods to revert check-in / check-out actions on a given reservation.
Url: https://kapi.wubook.net/kp/reservations/undo_checkin
Url: https://kapi.wubook.net/kp/reservations/undo_checkout
Usage example
Following parameters can / must be used in order to use this call
Field name |
Description |
Mandatory |
---|---|---|
reservation_id |
reservation id |
yes, if not human_code |
human_code |
reservation code of the form (XY-0001) |
yes, if not id |
$ curl --location --request POST 'https://kapi.wubook.net/kp/reservations/undo_checkin' \
--header 'x-api-key: wb_yyyyyyyyyyy' \
--header 'x-api-provider-key: kp_xxxxxxxxx'
--data-urlencode 'reservation_id=599' \
--data-urlencode 'all='\''true'\
>>> import requests
>>> headers = {'x-api-key':'123456', 'x-api-provider-key':'654321'}
>>> body = {'reservation_id':'123', 'all':'x'}
>>> response= requests.post('https://kapi.wubook.net/kp/reservations/undo_checkin', headers = headers, data = body)
>>> print(response.text)
Response example
${"data": {
"success": "true"
}
${ "error": "the error" }
Add Customer
This section describes how to add customer to a given reservation.
Url: https://kapi.wubook.net/kp/reservations/add_customer
Usage example
Following parameters can / must be used in order to use this call
Field name |
Description |
Mandatory |
---|---|---|
reservation_id |
reservation id |
yes, if not human_code |
human_code |
reservation code of the form (XY-0001) |
yes, if not reservation_id |
reservation_room_id |
reservation room id |
yes |
custdata |
json object containing customer to add |
yes |
docdata |
json object containing document to add |
yes |
A customer data is
Field name |
Description |
Mandatory |
---|---|---|
name |
str |
yes |
surname |
str |
yes |
country |
str (‘IT’, ‘GB’, ‘ES’..) |
no |
birth_contry |
str (‘IT’, ‘GB’, ‘ES’..) |
no |
residence_country |
str (‘IT’, ‘GB’, ‘ES’..) |
no |
birthday |
str ( ‘10/01/1993’ ) |
no |
phone |
str |
no |
zipcode |
str |
no |
address |
str |
no |
city |
str |
no |
birth_city |
str |
no |
str |
no |
|
gender |
str (‘m’, ‘f’, ‘x’) |
no |
A docdata is
Field name |
Description |
Mandatory |
---|---|---|
doc_type |
str (see doc types in syms) |
yes |
doc_country |
str (‘italy’, ‘spain’ …) |
yes |
doc_number |
str |
yes |
doc_issue |
str |
yes |
doc_expiry |
str |
yes |
$ curl --location --request POST 'https://kapi.wubook.net/kp/reservations/add_customer' \
--header 'x-api-key: wb_yyyyyyyyyyy' \
--header 'x-api-provider-key: kp_xxxxxxxxx'
--data-urlencode 'id=599' \
--data-urlencode 'custdata={}'\
--data-urlencode 'all='\''true'\
>>> import requests
>>> import json
>>> headers = {'x-api-key':'123456', 'x-api-provider-key':'654321'}
>>> custdata = {...}
>>> custdata = json.dumps(custdata)
>>> body = {'id':'123', 'custdata': custdata}
>>> response= requests.post('https://kapi.wubook.net/kp/reservations/undo_checkin', headers = headers, data = body)
>>> print(response.text)
Response example
${"data": {
"customer_id": "10",
"reservation_room_customer_id": "15",
}
${ "error": "the error" }
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 'id=47'
>>> import requests
>>> headers = {'x-api-key':'123456', 'x-api-provider-key':654321}
>>> data = {'id': 1}
>>> response= requests.post('https://kapi.wubook.net/kp/reservations/get_meals', headers = headers, data = data)
>>> print(response.text)
Response example
${"data": [
{"id": 34 . . },{"id": 35 . . }, {}, {}
]
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 |
---|---|---|---|
id |
reservation 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 'id=47' -d 'meal'='{}'
>>> import requests
>>> import json
>>> headers = {'x-api-key':'123456', 'x-api-provider-key':654321}
>>> meal = {'theconfig':mealconfig}
>>> json.dumps(meal)
>>> data = {'id': 1, 'meal': meal}
>>> response= requests.post('https://kapi.wubook.net/kp/reservations/add_meal', headers = headers, data = data)
>>> print(response.text)
Response example
${
"data": 1
}
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 id, 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 'id=47' -d 'fmid=1'
>>> import requests
>>> headers = {'x-api-key':'123456', 'x-api-provider-key':'654321'}
>>> data = {'id': 1, 'fmid':1}
>>> response= requests.post('https://kapi.wubook.net/kp/reservations/del_meal', headers = headers, data = data)
>>> print(response.text)
Response example
${
"data": 1:.. warning::
}