Skip to main content

Filtering Charges Using the REST API

Need to filter price list items that have fees?

Written by Petr Pech

You can't directly filter price list items by whether they have a fee — poplatky is a relation, not a property, so trying to filter by it will result in a Vlastnost 'poplatky' neexistuje error. However, there are two workarounds available.


Via the price list and the fee relation

GET /c/{firma}/cenik.json?limit=0&relations=poplatky

You get all price list items, and those with a fee will have the poplatky relation populated — items without a fee then need to be filtered out by the caller. In the test data, 21 out of 290 items had a fee.


Via the fee register

The opposite approach is more efficient: you query the fees directly, and use the cenikOtec field to find out which item they belong to.

GET /c/{firma}/poplatek/(cenik='code:RECYKLACE 5').xml?detail=custom:cenikOtec(kod,nazev)&includes=/poplatek/cenikOtec

Register fields poplatek:

Field

Meaning

cenik

The price list item that represents the fee (has the Fee stock type).

cenikOtec

The price list item to which the fee is assigned.

mnozMj, typPoplatkuK

The quantity and type of the fee.

💡 If you'd like to get the parent item's properties directly instead of links, expand the relation using the includes parameter — this principle is described in the article Using includes.


Related

Did this answer your question?