Skip to main content

API - Directory - Relationship Type - Filters

Filtering the directory by relationship type

Written by Petr Pech

The address book has a relationship type in the typVztahuK field. There are two ways to filter by it, which differ in how broad the result set is.


Exact match

A standard filter in the URL returns only records that have exactly the selected value:

GET /c/{firma}/adresar/(typVztahuK='typVztahu.dodavatel').json
GET /c/{firma}/adresar/(typVztahuK='typVztahu.odberatel').json
GET /c/{firma}/adresar/(typVztahuK='typVztahu.odberDodav').json

A company marked as Customer/Supplier will therefore not appear in the result for dodavatel.


Web interface quick filter

The second option uses the filter[…] syntax and behaves like the filter in the application — it looks for companies that can appear in the given role:

GET /c/{firma}/adresar.json?filter[typVztahuK]=typVztahu.dodavatel
GET /c/{firma}/adresar.json?filter[typVztahuK]=typVztahu.odberatel
GET /c/{firma}/adresar.json?filter[typVztahuK]=typVztahu.odberDodav

The difference can be seen in the counts — on the same data, the exact filter returns 6 suppliers, while the quick filter returns 157 records, because it also includes the combined type and companies that don't have the relationship type filled in:

Filter

What it includes

(typVztahuK='typVztahu.dodavatel')

Supplier only.

?filter[typVztahuK]=typVztahu.dodavatel

Supplier + Customer/Supplier + records with no type set.

?filter[typVztahuK]=typVztahu.odberDodav

Supplier + Customer + Customer/Supplier + records with no type set.

⚠️ The filter[…] syntax is taken from the web interface and is not part of the documented API — its behavior may change. For integrations, the exact filter is safer, or alternatively (typVztahuK='…' or typVztahuK='typVztahu.odberDodav').

ℹ️ The typVztahuK field also offers other values — typVztahu.vyrobce, typVztahu.socialka, typVztahu.zdravotka, typVztahu.financniUrad. The complete list is provided by /c/{firma}/adresar/properties.xml.


Related

Did this answer your question?