Skip to main content

Test Save (Dry Run)

Checking data via dry run

Written by Lenka Haringerová

When working with the REST API and you need to check that all data is correct—for example, if the user changed a value that affects another one (such as document type and posting), or you need to calculate the resulting price for an order—you can use dry-run mode.

When saving, add the parameter ?dry-run=true. As a result, the record will not be saved, but only the validations will be performed. In addition, you will get the resulting representation of the record in the <content /> tag, showing how it would look if you saved it now.


Example of the resulting XML

<?xml version="1.0" encoding="utf-8"?> 
<winstrom version="1.0">
<success>true</success>
<warnings> <warning for="firma">Nebyl určen příjemce a tak nebude doklad zaúčtován.</warning>
<warnings>
<result>
<content>
<!-- Doklady faktur -->
<faktura-vydana>
<!-- ID (celé číslo) - -->
<id>-1</id>
<!-- Interní číslo (řetězec) - max. délka: 20 -->
<kod>00000041/09</kod>
<!-- Variabilní symbol (řetězec) - -->
<varSym>0000004109</varSym>
<!-- Vystaveno (datum) - -->
<datVyst>2009-08-12+02:00</datVyst>
...
</faktura-vydana>
</content>
</result>
</winstrom>


In this case, a document number was also assigned. However, the number was immediately released for further use, so it is possible that the document will receive a different number when actually saved. There is also an example of a validation warning.

The output can also be processed in JSON format.

Did this answer your question?