Zak API to manage customers
Fetch Customer by id
Url: https://kapi.wubook.net/kp/customers/fetch_one
Usage example
At least only the customer id is required:
Field name |
Description |
Mandatory |
---|---|---|
id |
customer id |
yes |
$ curl --location --request POST 'https://kapi.wubook.net/kp/customers/fetch_one' \
--header 'x-api-key: wb_yyyyyyyyyyy' \
--data-urlencode 'id=277'
>>> import requests
>>> headers = {'x-api-key':'wb_yyyyyyyyyyy'}
>>> data = {'id':277}
>>> response= requests.post('https://kapi.wubook.net/kp/customers/fetch_one', headers = headers, data = data)
>>> print(response.text)
Response Example
A data structure containing customer info:
Field name |
Description |
---|---|
name |
Customer name |
surname |
Customer surname |
country |
Country |
city |
City |
address |
Address |
zipcode |
Zipcode |
cf |
Tax ID code |
creation |
Date of customer creation |
gender |
Gender |
birth_country |
Birth Country |
birth_city |
Birth City |
birthday |
Birthday |
phone |
phone number |
bill_address |
Billing info Address |
bill_city |
Billing info City |
bill_zip |
Billing info ZIP |
bill_country |
Billing info Country |
bill_name |
Billing info Name |
vat_number |
Billing info vat number |
$ "data":{
"main_info":{
"name":"Mario",
"surname":"Giuseppe",
"country":"PM",
"city":"Petit Barachois",
"zipcode":"96271",
"cf":null,
"creation":"29/09/2020",
"address":null
},
"anagraphical":{
"gender":"m",
"birth_country":"PM",
"birth_city":"Alabama",
"birthday":"10/10/1952"
},
"contacts":{
"email":"therealemail@gmail.com",
"phone":null
},
"billing_info":{
"address":null,
"city":null,
"zip":null,
"country":null,
"name":null,
"vat_number":null
},
"doc_data":[
{
"doc_type":"it_TESDI",
"doc_country":"PM",
"doc_number":"1",
"doc_issuer":null,
"doc_issue":"27/11/1989",
"doc_expiry":"21/06/2027",
"doc_medium":null
},
{
"doc_type":"p",
"doc_country":"IT",
"doc_number":"123ABC456",
"doc_issuer":null,
"doc_issue":"01/01/2010",
"doc_expiry":"01/01/2030",
"doc_medium":null
}
]
}
Upload customer document
Url: https://kapi.wubook.net/kp/customers/upload_docdata
Usage example
The customer id is mandatory
Field name |
Description |
Mandatory |
---|---|---|
id |
customer id |
yes |
docdata |
json object containing document data |
yes |
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 |
doc_issuer |
str |
no |
doc_medium |
str |
no |
$ curl --location --request POST 'https://kapi.wubook.net/kp/customers/upload_docdata' \
--header 'x-api-key: wb_yyyyyyyyyyy' \
--data-urlencode 'id=277' \
--data-urlencode 'docdata={"doc_type": "p", "doc_country": "Italy", "doc_number": "123ABC456", "doc_issue": "01/01/2010", "doc_expiry": "01/01/2030"}'
>>> import requests
>>> import json
>>> headers = {'x-api-key':'wb_yyyyyyyyyyy'}
>>> docdata = {'doc_type': 'p', 'doc_country': 'PM', 'doc_number': '123ABC456', 'doc_issue': '01/01/2010', 'doc_expiry': '01/01/2030'}
>>> docdata = json.dumps(docdata)
>>> data = {'id': 277, 'docdata': docdata}
>>> response= requests.post('https://kapi.wubook.net/kp/customers/upload_docdata', headers = headers, data = data)
>>> print(response.text)
Response example
Return the customer id
${"data": 277}
Add one customer
Url: https://kapi.wubook.net/kp/customers/add_one
Usage example
The customer name and surname are mandatory
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 |
$ curl --location --request POST 'https://kapi.wubook.net/kp/customers/add_one' \
--header 'x-api-key: wb_yyyyyyyyyyy' \
--data-urlencode 'custdata={"name": "Mario", "surname": "Rossi", "email":"therealemail@gmail.com", "gender": "m"}'
>>> import requests
>>> import json
>>> headers = {'x-api-key':'wb_yyyyyyyyyyy'}
>>> custdata = {'name': 'Mario', 'surname': 'Rossi', 'email': 'therealemail@gmail.com', 'gender': 'm'}
>>> custdata = json.dumps(custdata)
>>> data = {'custdata': custdata}
>>> response= requests.post('https://kapi.wubook.net/kp/customers/add_one', headers = headers, data = data)
>>> print(response.text)
Response example
Return the customer id
${"data": 2237}
Update customer info
Url: https://kapi.wubook.net/kp/customers/update_custdata
Usage example
The customer id is mandatory
Field name |
Description |
Mandatory |
---|---|---|
id |
customer id (you can see from the reservation results) |
yes |
custdata | json object containing document to add |
yes (at least 1) |
A customer data is
Field name |
Description |
Mandatory |
---|---|---|
name |
str |
no |
surname |
str |
no |
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 |
$ curl --location --request POST 'https://kapi.wubook.net/kp/customers/update_custdata' \
--header 'x-api-key: wb_yyyyyyyyyyy' \
--data-urlencode 'id=277' \
--data-urlencode 'custdata={"name": "Mario", "email":"therealemail@gmail.com", "gender": "m"}'
>>> import requests
>>> import json
>>> headers = {'x-api-key':'wb_yyyyyyyyyyy'}
>>> custdata = {'name': 'Mario', 'email': 'therealemail@gmail.com', 'gender': 'm'}
>>> custdata = json.dumps(custdata)
>>> data = {'id': 277, 'custdata': custdata}
>>> response= requests.post('https://kapi.wubook.net/kp/customers/update_custdata', headers = headers, data = data)
>>> print(response.text)
Response example
Return the customer id
${"data": 277}