When exporting XML from the system, many fields are exported. However, many of them are read-only (e.g., the current average warehouse price) and therefore cannot be modified. At the same time, it is not necessary to specify many values, because they are either default values or are taken from the document type.
Rules for creating XML
Generally, you only need to fill in the fields that you would have to enter in the application when manually creating a record.
However, some fields need to be specified because the application offers a default value for them, but in imports they must be stated explicitly.
The document type field (
<typDokl/>) is almost always required. It determines what type the given document is (e.g., invoice, advance payment, etc.).You only need to state the value within the tag (without attributes). The
refandshowAsattributes are ignored and, in the export, are only there to make it easier for the user to visualize.When linking to another system, you need to provide identifiers. These can be of various types (
code:,ext:,ean:, …).Depending on the document type, you may find that an attribute is required in one case but not in another.
How to find out which fields are required
You don't have to guess — the properties overview of the record type tells you directly. Each field in the /properties output carries the mandatory and isWritable flags:
GET /c/<identifikátor firmy>/<evidence>/properties.xml
<property>
<propertyName>typDokl</propertyName>
<name>Typ dokladu</name>
<type>relation</type>
<mandatory>true</mandatory>
<isWritable>true</isWritable>
</property>
| The field is required — without it, the record import will fail. |
| A value of |
| Whether the value can be overwritten, even though the system calculates it automatically. |
💡 For an issued invoice, out of 179 properties, only nine have the mandatory flag (among them typDokl, datVyst, kod, and varSym), and 38 properties are read-only. It therefore pays off to go through /properties once before assembling your import XML by trial and error.
Verification without saving
The easiest way to check whether your XML is complete is with a test save — by adding the ?dry-run=true parameter, the record will not be saved, but all validations will run.
