The Recalculate feasibility percentage function, which you know from the desktop and web application, can also be triggered via the REST API. It updates the % feasibility column on received orders, which indicates what percentage of an order you are currently able to fulfill from stock on hand.
ℹ️ This service is only available for the received orders records and always recalculates all open orders — individual documents cannot be selected.
How the percentage is calculated
For each item, the system determines what part of the ordered quantity can be covered from stock. However, the resulting percentage on the document is not an average of the quantities — individual items are factored in weighted by their value. The percentage therefore expresses what portion of the order's value you are able to fulfill.
Only items with a price list link are included in the total; the rounding item is ignored. Example: an order contains an item worth 950.64 CZK that stock cannot cover, and an item worth 1,823.76 CZK that is fully covered by stock. The resulting procReal is 1,823.76 / 2,774.40 = 65.74%.
⚠️ Since values are weighted, the feasibility percentage cannot be calculated for an item with a zero unit price (including a 100% discount) — the order will be left with a value of 0.
📝 You can work around this by saving the order with a non-zero unit price, running the recalculation, and only then changing the price to zero. The calculated value on the order will remain even after the price is set to zero.
Building the URL and calling the service
The service is available at an address composed of the objednavka-prijata record and the name prepocitat-realizovatelnost. It is called using the HTTP method PUT or POST, and the supported output formats are XML and JSON.
PUT https://demo.flexibee.eu/c/demo/objednavka-prijata/prepocitat-realizovatelnost.xml
PUT https://demo.flexibee.eu/c/demo/objednavka-prijata/prepocitat-realizovatelnost.json
Upon successful completion, the service returns 200 OK:
<?xml version="1.0" ?>
<winstrom version="1.0">
<success>true</success>
</winstrom>
The dry-run parameter
The dry-run=true parameter lets you check whether a recalculation is currently running — it does not trigger a recalculation itself. It returns 200 if a recalculation can be started, and 409 with information about when and by whom the running one was started.
PUT https://demo.flexibee.eu/c/demo/objednavka-prijata/prepocitat-realizovatelnost.json?dry-run=true
Without a format extension in the URL, specify the output using the Accept: application/xml or Accept: application/json header.
Failed requests
Situation | Response |
Another recalculation is already running, for example one started by a user in the application |
|
Calling with the |
|
Attempting to narrow the recalculation with a filter in the URL, for example |
|
The response for a concurrent recalculation includes the user's name and the time it was started:
<?xml version="1.0" ?>
<winstrom version="1.0">
<success>false</success>
<message messageCode="concurrentProcedureRunning">Aktuálně běžící operace 'Přepočítat procenta realizovatelnosti' špuštěná uživatelem dba v 08.09.2026, 20:27:08 nedovoluje současně spustit 'Přepočítat procenta realizovatelnosti'.</message>
</winstrom>
FAQ
Is it possible to recalculate only selected orders?
No. The service always recalculates the feasibility percentage for all open orders and rejects any filter in the URL.
How do I find out the current percentage?
Read the value from the procReal property on the received order. You can also hook into its change using a web hook.
How do I know when the recalculation has finished?
The call is synchronous — the 200 response arrives only after completion. If a recalculation started elsewhere is still running, you can check this with a request using the dry-run=true parameter.
