.. meta:: :description: Zak API customers :keywords: api, pms, zak, kapi, booking, bookings, reservation, reservations, guest, customers Zak API to manage customers *************************** | These APIs allow you to manage customers of a Zak property .. _wb_yyyyyyyyyyy: ../kapi/introduction.html#authentication | On each examples `wb_yyyyyyyyyyy`_ is used as **api-key** which is sent as *user*. Fetch Customer by id ===================== | This method provides customers data. .. code-block:: html Url: https://kapi.wubook.net/kp/customers/fetch_one | Usage example ------------- At least only the customer id is required: .. table:: :widths: auto +--------------------------+---------------------+----------------------------+ | **Field name** | **Description** | **Mandatory** | +==========================+=====================+============================+ | *id* | customer id | yes | +--------------------------+---------------------+----------------------------+ .. tabs:: .. code-tab:: bash curl $ curl --location --request POST 'https://kapi.wubook.net/kp/customers/fetch_one' \ --header 'x-api-key: wb_yyyyyyyyyyy' \ --data-urlencode 'id=277' .. code-tab:: py >>> 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: .. table:: :widths: auto +--------------------------+-----------------------------------------------------------------------------------------+ | **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 | +--------------------------+-----------------------------------------------------------------------------------------+ | *email* | email | +--------------------------+-----------------------------------------------------------------------------------------+ | *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 | +--------------------------+-----------------------------------------------------------------------------------------+ .. code-block:: shell $ "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 ===================== | This method allows you to upload a document to an existing customer .. code-block:: html Url: https://kapi.wubook.net/kp/customers/upload_docdata | Usage example ------------- The customer id is mandatory .. table:: :widths: auto +--------------------------+-----------------------------------------+----------------------------+ | **Field name** | **Description** | **Mandatory** | +==========================+=========================================+============================+ | *id* | customer id | yes | +--------------------------+-----------------------------------------+----------------------------+ | *docdata* | json object containing document data | yes | +--------------------------+-----------------------------------------+----------------------------+ A docdata is .. table:: :widths: auto +----------------------------+-----------------------------------------------------------+----------------------------------------+ | **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 | +----------------------------+-----------------------------------------------------------+----------------------------------------+ .. tabs:: .. code-tab:: bash curl $ 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"}' .. code-tab:: py >>> 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 .. code-block:: shell ${"data": 277} | Add one customer ===================== | This method allows you to add new customer .. code-block:: html Url: https://kapi.wubook.net/kp/customers/add_one | Usage example ------------- The customer name and surname are mandatory .. table:: :widths: auto +----------------------------+-----------------------------------------------------------+----------------------------------------+ | **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 | +----------------------------+-----------------------------------------------------------+----------------------------------------+ | *email* | str | no | +----------------------------+-----------------------------------------------------------+----------------------------------------+ | *gender* | str ('m', 'f', 'x') | no | +----------------------------+-----------------------------------------------------------+----------------------------------------+ .. tabs:: .. code-tab:: bash curl $ 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"}' .. code-tab:: py >>> 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 .. code-block:: shell ${"data": 2237} | Update customer info ===================== | This method allows you to update an existing customer .. code-block:: html Url: https://kapi.wubook.net/kp/customers/update_custdata | Usage example ------------- The customer id is mandatory .. table:: :widths: auto +--------------------------+--------------------------------------------------------------+----------------------------+ | **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 .. table:: :widths: auto +----------------------------+-----------------------------------------------------------+----------------------------------------+ | **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 | +----------------------------+-----------------------------------------------------------+----------------------------------------+ | *email* | str | no | +----------------------------+-----------------------------------------------------------+----------------------------------------+ | *gender* | str ('m', 'f', 'x') | no | +----------------------------+-----------------------------------------------------------+----------------------------------------+ .. tabs:: .. code-tab:: bash curl $ 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"}' .. code-tab:: py >>> 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 .. code-block:: shell ${"data": 277} |