.. meta:: :description: Zak API introduction :keywords: api, pms, zak, introduction, error, authentication, response Introduction ************ | To use the api is enough to make a simple POST call to the addresses of our resources. .. code-block:: html Starting url: https://kapi.wubook.net/kapi/ Field types =========== | Each *date field* has the European format *dd/mm/yyyy*. | The data that fills the *country field* must be 2 characters `ISO country code`_. | The *currency fields* should contain `ISO currency code`_. .. _ISO country code: https://en.wikipedia.org/wiki/ISO_3166-1 .. _ISO currency code: https://en.wikipedia.org/wiki/ISO_4217 Authentication ============== | To use our API you will need to use the API keys. These must be passed in the header of all the requests you intend to make. | We have two levels of APIs: customer and provider. | To use the **first level** of APIs it will be necessary to provide the **customer api-key** as header in each request, which can be generated through the **zak-api | plugin (KAPI)** from its Zak extranet. | To use the **second level** of APIs it will be necessary to provide **both** the **customer api-key** and the **provider-api-key**. | Each of the following examples will be provided with a fake customer api-key *123456* and, when necessary, a fake provider api-key *654321* . | | The customer of the ZaK pms could match the api-key with a **list of IP**, | in this case only calls from one of those IPs are authorized. Response ======== | The response is always an object with one field: **data** or **error**. | The **error** field contains a text that describes the error. | The **data** field contains the results. | | To interpret the symbols that an api returns or to know the symbol | to be sent as input you can get the zak symbols from the `api-symbols`_. .. _api-symbols: ./symbols.html#zak-api-to-read-symbols Examples -------- | The endpoint **test** could be used to check your *api-key*, | it does not require other input parameters. | On the examples *123456* is used as **api-key** | which is sent as *user*. python code: ............ .. code-block:: python import requests uspw=(123456, None) response= requests.post('https://kapi.wubook.net/kapi/test', {}, auth= uspw) print(response.text) {"data": "Authentication done!"} In case of error the response key is **error** and provides an error-description. .. code-block:: python import requests uspw=(654321, None) response= requests.post('https://kapi.wubook.net/kapi/test', data={}, auth= uspw) print(response.text) {"error": "Authentication error"} uspw=(123456, None) response= requests.post('https://kapi.wubook.net/kapi/tset', data={}, auth= uspw) print(response.text) {"error": "Wrong api name: tset"} curl: ..... .. code-block:: shell $ curl https://kapi.wubook.net/kapi/test -u 123456: -X POST {"data": "Authentication done!"}