Skip to main content

Record Update History in the REST API

How to retrieve the history of a record via the REST API?

Written by Petr Pech

Similarly to the application, you can also look up the history of selected records via the REST API. Selected records keep track of changes made to records and their individual fields — the so-called journal — and the change log gives you access to view and further analyze them.


Building the URL

The service is a subresource of a specific record:

GET https://demo.flexibee.eu/c/demo/faktura-vydana/1/zmeny.json

In the address /c/{firma}/{evidence}/{id}/zmeny, {firma} is the database identifier of the company, {evidence} of the record type, and {id} the identifier of the record. How to build the address is described in the guide on building the URL address. Common parameters such as limit and add-row-count also work.


In which records is the change log available

Changes are saved to the journal for most, but not all, record types — the subresource /zmeny is therefore only available for some, just as in the application:

  • issued and received invoices,

  • bank, cash register, and internal documents,

  • received and issued orders,

  • goods received and issued notes,

  • address book,

  • price list,

  • assets,

  • price levels,

  • contracts,

  • document types.

ℹ️ Don't confuse an error with two different 404: formZaznamNenalezen means that the subresource exists, but there is no record with the given ID. The code adresaNeplatnaUrl, on the other hand, means that this record type doesn't have a change log at all.


Sample output

Each row describes one change to one field — the column name in the database, the original and new value, the user, and the time:

{
"winstrom":{
"@version":"1.0",
"zmeny":[
{
"hlavicka_polozka":"Hlavička dok.",
"nazev":"",
"poradi_polozky":"",
"sloupec":"juhsum",
"puvodni_hodnota":"0.00",
"zmenena_na":"2500.00",
"uzivatelem":"knovak",
"operace":"změna",
"datcas":"2018.01.11 - 13:13:43"
},
{
"hlavicka_polozka":"Hlavička dok.",
"nazev":"",
"poradi_polozky":"",
"sloupec":"stavuhrk",
"puvodni_hodnota":"",
"zmenena_na":"stavUhr.uhrazeno",
"uzivatelem":"knovak",
"operace":"změna",
"datcas":"2018.01.11 - 13:13:43"
}
]
}
}

For documents, hlavicka_polozka and poradi_polozky distinguish whether it was a change to the header or to a specific line item, and operace carries values such as inserted or changed. For the price list, address book, and lookup lists, these three properties are not returned — the output only contains nazev, sloupec, puvodni_hodnota, zmenena_na, uzivatelem, and datcas.

📝 The sloupec property contains the column name in the database (for example stavuhrk), not the property names used in the REST API. If you instead need to find out which records have changed since a certain point in time, use the Changes API.


Related

Did this answer your question?