Skip to main content

Batch Operations

Updating Multiple Records at Once

Written by Lenka Haringerová

When importing, a single element can update multiple records at once. For example, this adds the label VIP to all price list items with the supplier FIRMA:

<?xml version="1.0"?>
<winstrom version="1.0">
<cenik filter="dodavatel = 'code:FIRMA'">
<stitky>VIP</stitky>
</cenik>
</winstrom>

The filter attribute determines the records from the given evidence (here cenik) on which the operation is performed. The filtering language is the same as in the REST API.

Batch processing works as if, instead of a single cenik element with the filter attribute, there were cenik elements listed for all records matching the given condition.

⚠️ The only difference is that in batch operations, the id elements are completely ignored. The target set of records is determined exclusively by filter.


Writing in JSON

You can, of course, also use the JSON format to specify a batch operation:

{
"winstrom": {
"@version": "1.0",
"faktura-vydana": {
"@filter": "stitky='code:OVERENO'",
"@action": "lock"
}
}
}

This example would trigger the action lock on all records in the faktura-vydana evidence that have the label OVERENO assigned.


What to watch out for

  • The filter may cover far more records than you expect. Before running the operation, verify its scope by reading first — send the same filter as a GET request with ?add-row-count=true and check the number of records.

  • You can do a dry run of a batch operation using the ?dry-run=true parameter.

  • If the filter matches no records, the operation completes successfully and does nothing — you will not get an error.


Related

Did this answer your question?