Skip to main content

Advanced examples of API calls

Call examples with filtering, relations, and nested records — invoice with items and price list, payment of advance invoices

Written by Petr Pech

Examples of calls that combine filtering, level of detail, relations, and nested records. Use these as a template when you need to pull, in a single request, data that in ABRA Flexi is spread across several records.


Issued invoice including line items and price list data

The relations parameter adds the invoice's line items to the output, and includes pulls in the linked price list item:

GET /c/{firma}/faktura-vydana.xml
?detail=full
&relations=polozkyDokladu
&includes=faktura-vydana/polozkyDokladu/faktura-vydana-polozka/cenik/

💡 Instead of detail=full, it's more efficient to list the required fields explicitly via detail=custom:… — the response is smaller and the server builds it faster.


Payments of advance invoices via relations

This query selects paid advance invoices and, for each one, also lists the document that paid it:

GET /c/{firma}/faktura-vydana/(typDokl='code:ZÁLOHA'
and stavUhrK in ('stavUhr.uhrazeno','stavUhr.uhrazenoRucne')
and id>=10).xml
?detail=custom:id,varSym,datUhr,vazby(typVazbyK,b(id),a(id))
&relations=vazby
&includes=/faktura-vydana/vazby/vazba/b/
&limit=0

In the relation, a is the document being paid and b is the paying document; typVazbyK indicates the type of relation (for example, typVazbyDokl.uhradaZALOHY or typVazbyDokl.odpocetZALOHY).

⚠️ The filter in the URL must be encoded — spaces as %20, > as %3E. An unencoded filter will return an HTML page instead of data; see Error 400 when sending a URL.


Related

Did this answer your question?