Reliability

API contains a few features and checks to help develop more reliable integrations and to filter out duplicated requests.

Idempotent Creation of New Sales Documents

API call saveSalesDocument supports idempotency when creating new sales documents.

API client can add input parameter "temporaryUUID" to the request. Subsequent calls with the same "temporaryUUID" will be rejected with error code 1206.

Read more about the feature.

Elimination of Duplicate Sales Documents

Even if API client is not using the "temporaryUUID" input parameter, API still compares the submitted document to sales documents already stored in the system. If the document appears to be identical to an already-existing one, API will discard the request and return the ID and details of the already-existing documents.

The same is done with payments (API call savePayment).

Documentation of the detection algorithm

Prevention of Simultaneous Edits

API prevents simultaneous edits of the same sales document, to avoid race conditions.

If two API clients have simultaneously issued a saveSalesDocument call with the same document ID (or one client has issued the same call multiple times), the calls will be processed in sequence.

Generally, API clients should avoid editing the same document with multiple calls at the same time: the outcome may be unpredictable. API will accommodate such situations to a certain extent (by processing the calls in-order), but within reasonable technical limitations.

In case one of the calls takes an exceedingly long time (at the moment configured as 5 seconds), the other calls will be dropped and will return error code 1205. This should generally never happen and has been implemented just as a last-resort protection.

Prevention of Simultaneous Deletes

API calls that delete a document (deleteSalesDocument, deletePurchaseDocument, deleteInventoryRegistration, deleteInventoryTransfer, deleteInventoryWriteOff) will return error code 1204 if the same document is already being deleted by another API call.