Skip to main content

API - Recalculation of Selling Prices

How to recalculate the selling price in a price list or product group according to the set pricing rules via API?

Written by Petr Pech

The REST API can recalculate the sales price of a price list item according to the rules configured for it — default price, calculation method, percentage, and rounding. The recalculation can be run on a single price list item, or on an entire product group; both variants have their own endpoint.


Price list

PUT /c/{firma}/cenik/(filtr)/prepocti-prodejni-cenu

Instead of a filter, you can specify the price list item ID directly:

PUT https://demo.flexibee.eu/c/demo/cenik/147/prepocti-prodejni-cenu

You can also use any filtering to recalculate multiple items with a single request:

PUT https://demo.flexibee.eu/c/demo/cenik/(skupZboz='code:ZBOŽÍ')/prepocti-prodejni-cenu


Product group

PUT /c/{firma}/skupina-zbozi/(filtr)/prepocti-prodejni-cenu

Recalculating a product group processes all price list items belonging to that group. Again, the filter can be replaced with the group ID itself:

PUT https://demo.flexibee.eu/c/demo/skupina-zbozi/7/prepocti-prodejni-cenu


What the price is calculated from

The recalculation does not accept any data in the request body — it is based exclusively on the settings of the price list item, or product group, respectively:

Property

Meaning

typCenyVychoziK

The default price used as the calculation basis — for example typCenyVychozi.nakCena (purchase price).

typVypCenyK

Calculation method — typVypCeny.prirazka, typVypCeny.rabat, and others.

procZakl

Margin, markup, rebate, or discount, expressed as a percentage.

zaokrJakK, zaokrNaK

The method and precision used for rounding the resulting price.

The result is written to cenaZakl (and the derived cenaZaklBezDph and cenaZaklVcDph). For example, an item with a purchase price of 75 and a markup of 100% results in a sales price of 150.

ℹ️ If an item's default price is set to typCenyVychozi.zadna, there is nothing to calculate from, and the recalculation leaves it unchanged.


Response and error states

A successful recalculation returns 200 OK:

<?xml version="1.0" ?>
<winstrom version="1.0">
<success>true</success>
</winstrom>

⚠️ The response does not indicate how many records were recalculated. A filter that finds nothing — including a reference to a non-existent ID — also returns 200 with success true. Therefore, verify the result by reading cenaZakl for the affected items.

Situation

Response

Called using the GET or DELETE method

405 Method Not Allowed

Incorrectly written service name in the URL

404, adresaNeplatnaUrlThe address … is not valid.


Related

Did this answer your question?