.. meta:: :description: Wired Zak API read invoices :keywords: api, pms, zak, kapi, invoices, bill, bills Zak API to read invoices ************************ | These APIs allow you to read the invoices data of a zak property. Get invoices by number ====================== | This method provides invoices with document-number between a range of numbers. | Could accept a filter by *billing year* and by *document type*. | *To prevent overflow, the maximum limit of records is 200.* .. code-block:: html Url: https://kapi.wubook.net/kapi/invoices/get_by_numbers | Input fields: *nfrom*, *nto* are mandatory. Input fields *year*, *prefix* and *dtype* are optional. | If *year* filter is passed, it returns invoices dated on *year*. | If *year* filter is not passed, it returns the invoices of the current year. | If *prefix* filter is passed, it returns invoices with that same prefix. | If dtype_ filter is passed, it return only the fiscal documents of the indicated type. | Response-data: list of invoices data. | For every invoice are provided the following data: .. table:: :widths: auto +--------------------------+-----------------------------------------------------------------------------------------+ | **Field name** | **Description** | +==========================+=========================================================================================+ | *doc_type* | `fiscal document type code`_. (*'INV'*, *'REC'*, *'CRN'*, ...) | +--------------------------+-----------------------------------------------------------------------------------------+ | *num* | document number | +--------------------------+-----------------------------------------------------------------------------------------+ | *prefix* | document number prefix (generally it is null) | +--------------------------+-----------------------------------------------------------------------------------------+ | *date* | date of document | +--------------------------+-----------------------------------------------------------------------------------------+ | *name* | customer name | +--------------------------+-----------------------------------------------------------------------------------------+ | *address* | customer address | +--------------------------+-----------------------------------------------------------------------------------------+ | *zipcode* | customer zipcode | +--------------------------+-----------------------------------------------------------------------------------------+ | *city* | customer city | +--------------------------+-----------------------------------------------------------------------------------------+ | *country* | customer country `ISO code`_ | +--------------------------+-----------------------------------------------------------------------------------------+ | *nationalid* | customer fiscal code | +--------------------------+-----------------------------------------------------------------------------------------+ | *vatnumber* | customer vat number | +--------------------------+-----------------------------------------------------------------------------------------+ | *email* | customer email address | +--------------------------+-----------------------------------------------------------------------------------------+ | *phone* | customer phone number | +--------------------------+-----------------------------------------------------------------------------------------+ | *currency* | amount currency | +--------------------------+-----------------------------------------------------------------------------------------+ | *amount* | amount | +--------------------------+-----------------------------------------------------------------------------------------+ | *tax_amount* | amount of taxes | +--------------------------+-----------------------------------------------------------------------------------------+ | *tax_rate* | list of percentage rate of tax | +--------------------------+-----------------------------------------------------------------------------------------+ | *total* | total (amount + taxes) | +--------------------------+-----------------------------------------------------------------------------------------+ | *biller* | biller data | +--------------------------+-----------------------------------------------------------------------------------------+ | *notes* | notes | +--------------------------+-----------------------------------------------------------------------------------------+ | *services* | List of services_ sold (detail of invoice) | +--------------------------+-----------------------------------------------------------------------------------------+ | *xml* | electronic invoice | +--------------------------+-----------------------------------------------------------------------------------------+ | *off* | cancellation date (if any) | +--------------------------+-----------------------------------------------------------------------------------------+ | *rcode* | reservation code | +--------------------------+-----------------------------------------------------------------------------------------+ .. _fiscal document type code: symbols.html#get-invoice-types .. _dtype: symbols.html#get-invoice-types .. _services: | *services* is an array of object with the following fields: .. table:: :widths: auto +--------------------------+-----------------------------------------------------------------------------------------+ | **Field name** | **Description** | +==========================+=========================================================================================+ | *quantity* | how many units | +--------------------------+-----------------------------------------------------------------------------------------+ | *description* | service description | +--------------------------+-----------------------------------------------------------------------------------------+ | *unitprice* | price of one unit | +--------------------------+-----------------------------------------------------------------------------------------+ | *amount* | amount of service | +--------------------------+-----------------------------------------------------------------------------------------+ | *currency* | amount currency | +--------------------------+-----------------------------------------------------------------------------------------+ | *tax_amount* | amount of taxes | +--------------------------+-----------------------------------------------------------------------------------------+ | *tax_rate* | percentage rate of tax | +--------------------------+-----------------------------------------------------------------------------------------+ | *total* | total (amount + taxes) | +--------------------------+-----------------------------------------------------------------------------------------+ .. _ISO code: https://en.wikipedia.org/wiki/ISO_3166-1 .. _123456: ../kapintro.html#authentication Examples -------- | On each examples `123456`_ is used as **api-key** which is sent as *user*. curl: ..... | The following example return **invoices** with number between (1, 20), of the current year. .. code-block:: shell $ curl https://kapi.wubook.net/kapi/invoices/get_by_numbers -u 123456: -X POST \ -d nfrom=1 -d nto=20 -d dtype=INV {"data": [{ "doc_type": "INV", "num": 1, "date": "06/11/2018", "name": "Georg Hegel", "address": "Weg der Aufhebung", "zipcode": null, "city": "Berlin", "country": "DE", "currency": "EUR", "nationalid": "GE3304HH22KK", "vatnumber": "054321-1234", "email": "foo@bar.com", "phone": "72768218", "amount": 200.0, "tax_amount": 44.0, "tax_rate": [22.0], "total": 244.0, "biller": "Schoenhouse Apartments", "notes": "Phanomenologie des Geistes", "off": "16/11/2018", "rcode": "AA-0001", "services": [{ "quantity": 5, "description": "Ungluck und Schmerz", "unitprice": 40.0, "amount": 200.0, "tax_amount": 44.0, "tax_rate": 22.0, "total": 244.0, "currency": "EUR"}] }] } python code: ............ | The following example return **credit notes** with number between (10, 20), of the current year. .. code-block:: python import requests data= {'nfrom': 10, 'nto': 20, 'dtype': 'CRN'} uspw= (123456, None) response= requests.post('https://kapi.wubook.net/kapi/invoices/get_by_numbers', data, auth= uspw) print(response.text) Get invoices by dates ===================== | Read all invoices with *bill-date* between a dates range. | *To prevent overflow, the maximum limit of records is 200.* .. code-block:: html Url: https://kapi.wubook.net/kapi/invoices/get_by_dates | Input fields *dfrom*, *dto* are mandatory. Filter field *dtype* is optional. | If dtype_ filter is passed, it return the fiscal documents of the indicated type. | Response-data: is an array of invoices. | Each invoice has the same format of `Get invoices by number`_ response. Examples -------- curl: ..... | The following example return the **receipts** with date on june 2018. .. code-block:: shell $ curl https://kapi.wubook.net/kapi/invoices/get_by_dates -u 123456: -X POST \ -d dfrom=01/06/2018 -d dto=30/06/2018 -d dtype=REC python code: ............ | The following example returns **all documents** with date on first quarter of 2018. .. code-block:: python import requests data= {'dfrom': '01/01/2018', 'dto': '31/03/2018'} uspw= (123456, None) response= requests.post('https://kapi.wubook.net/kapi/invoices/get_by_dates', data, auth= uspw) print(response.text) Get invoices by reservation =========================== | Read all invoices of a specific reservation. | *To prevent overflow, the maximum limit of records is 200.* .. code-block:: html Url: https://kapi.wubook.net/kapi/invoices/get_by_reservation | Input field *rcode* is mandatory. Filter fields *dtype* and *xml* are optional. | If dtype_ filter is passed, it returns the fiscal documents of the indicated type. | Response-data: is an array of invoices. | Each invoice has the same format of `Get invoices by number`_ response. Examples -------- curl: ..... | The following example returns the **receipts** of the reservation AA-0001. .. code-block:: shell $ curl https://kapi.wubook.net/kapi/invoices/get_by_reservation -u 123456: -X POST \ -d rcode=AA-0001 -d dtype=REC python code: ............ | The following example returns the **receipts** of the reservation AA-0001. .. code-block:: python import requests data= {'rcode': 'AA-0001', 'dtype': 'REC'} uspw= (123456, None) response= requests.post('https://kapi.wubook.net/kapi/invoices/get_by_reservation', data, auth= uspw) print(response.text)