Skip to main content

Performing Actions

Performing Actions in the REST API

Written by Petr Pech

During import, instead of the usual creation or modification of a record, another action can be performed, e.g. deleting or cancelling a document. The action attribute is used for this:

<?xml version="1.0"?>
<winstrom version="1.0">
<faktura-vydana action="delete">
<id>123</id>
<id>uuid:123456</id>
</faktura-vydana>
</winstrom>

Available actions

Action

Description

Delete
(delete)

The record will be deleted.

Cancel
(storno)

The record will be cancelled. Can only be used for documents.

⚠️ When performing actions, records are not otherwise modified, so it makes no sense to specify elements other than id. At the same time, the records must already exist — a reference to a nonexistent ID will result in a 400 error with code idNotFound. Therefore, it is not possible, for example, to create a new deleted invoice.

ℹ️ If you use an action on an evidence that does not support it (e.g. storno on the address book), the server will respond with 400 and code importXmlActionNotSupported.


Actions on items

Actions can also be triggered on document items. Not directly, however — as with an update, the request must be specified via the items collection on the corresponding document.

Example for deleting an item with ID equal to 456 in XML format:

<?xml version="1.0"?>
<winstrom version="1.0">
<faktura-vydana>
<id>123</id>
<polozkyFaktury>
<faktura-vydana-polozka id="456" action="delete"/>
</polozkyFaktury>
</faktura-vydana>
</winstrom>

The same in JSON format:

{
"winstrom": {
"@version": "1.0",
"faktura-vydana": [
{
"id": "123",
"polozkyFaktury": [
{ "id": "456", "@action": "delete" }
]
}
]
}
}


Related

Did this answer your question?