Skip to main content

Stock Recalculation - REST API

How to trigger a stock recalculation via REST API?

Written by Petr Pech

Warehouse recalculation checks and recalculates stock levels and prices for the selected accounting period. It can be triggered via REST API in the same way as in the application.


Calling method

The service is available via the methods PUT and POST at the address /c/{firma}/sklad/prepocet, where {firma} is the database company identifier. The supported output formats are XML and JSON.


Parameters

  • ucetniObdobi — a required parameter that identifies the period for which you want to recalculate the warehouse. It is specified as an identifier in the form code:2024.

  • dry-run — an optional parameter that can be used to determine whether the recalculation has been completed. If so, it returns HTTP status 200. If not, it returns HTTP status 409 along with information about when and by whom the recalculation was started.


Result

To determine whether the service was executed successfully, you can check either the HTTP status of the response or the success property in the returned document.

If the service is executed successfully, HTTP status 200 is returned along with a document corresponding to the standard format, see return values:

{
"winstrom": {
"@version": "1.0",
"success": "true"
}
}

In case of failure, status 4xx or 5xx is returned along with a message explaining the reason for the failure.


Sample calls

PUT https://demo.flexibee.eu/c/demo/sklad/prepocet.xml?ucetniObdobi=code:2024
PUT https://demo.flexibee.eu/c/demo/sklad/prepocet.json?ucetniObdobi=code:2024
PUT https://demo.flexibee.eu/c/demo/sklad/prepocet?ucetniObdobi=code:2024

For the last call without an extension, the format is determined by the Accept: application/xml header, or possibly Accept: application/json.


Related

Did this answer your question?