Skip to main content

User Queries

How to work with user queries via REST API?

Written by Lenka Haringerová

User queries can be worked with in the standard way via REST API:

/c/firma/uzivatelsky-dotaz

In addition, a user query can also be called directly.

The simplest query — one that has no parameters (or where all parameters have sufficient default values) — can be called as follows:

/c/firma/uzivatelsky-dotaz/1/call.xml (.json is also supported).

Where "/1" corresponds to the ID of the given user query.

The standard parameters for detail level or pagination are supported.

If the query has parameters, each query parameter must be specified as a URL parameter. For example, if the query has a parameter datum, the call looks like this: /c/firma/uzivatelsky-dotaz/1/call.xml?datum=2012-01-01.

If a query parameter has cardinality N — meaning multiple values can be provided — simply repeat the parameter in the URL. For example, to select several companies:

/c/firma/uzivatelsky-dotaz/1/call.xml?firma=code:FIRMA1&firma=code:FIRMA2.

In the saved query, use the IN operator (<<firma>>).

Parameter values are entered in the usual way, without enclosing them in quotation marks. Remember to apply correct URL encoding.

In addition to the GET method, the POST method can also be used to call a query, allowing a large number of parameters to be passed in the request body.

Saved queries can also be printed. A custom print template must be created for each saved query and selected within that query. Printing can then also be triggered via the REST API.

Did this answer your question?