Supporting versions allows for related systems to track the correct version of information, and to keep the integrity of clinical records. Kodjin provides versioning support and allows users to populate and track versionId , use vread and _history operations, perform version aware updates.
Whenever a new resource is created, Kodjin generates a version ID for it and returns it in the ETag header. The server also generates a Last-Modified header as well as a link to the history record in the Location header: Location: [base]/[type]/[id]/_history/[vid] Example:
Read more about Create here.
_history operation can be used to retrieve the history of either a particular resource, all resources of a given type, or all resources supported by the system, e.g.
Read more about _history here.
vread operation can be used to perform a version specific read of the resource, e.g.
Read more about vread here.
Whenever a resource is updated, Kodjin generates a new version ID and returns it in the ETag header. If the request body includes a meta, Kodjin ignores the provided versionId and lastUpdated values. If the resource is created (Create as Update), the server will return a Location header as it would for a regular create operation. See more about Update here.
Versioning also helps to manage resource contention. You can use the If-Match header to prevent Lost Updates , where two clients update the same resource, and the second overwrites the updates of the first. Submit the request with an If-Match header that quotes the ETag from the server:
The delete interaction does not remove a resource's version history. Though you will get 410 Gone status code accessing the deleted resource by ID, you can still perform _history or vread operations.
Read more about delete here.