ETags
Etags are identifiers for a specific version of a requested resource. Etags can be used to detect changes between Clio's data and your copy.
In all responses for single resources, we include ETag
and Last-Modified
HTTP headers in the response. etag
values can also be requested as a field for resources. ETags can be useful when both requesting from and writing to Clio, and we recommend retrieving and storing ETag values for all resources you access via the API.
ETags when reading data
When making GET
requests for individual resources, you can use both Etags and the Last-Modified timestamp value to quickly determine if a resource has changed since you last retrieved it.
You can provide one of two HTTP headers in your request – If-None-Match
or If-Modified-Since
– with the values of the resource's ETag value or Last-Modified timestamp, respectively. If either value matches the current values for that resource in Clio, it means the resource has not been modified and the API will return a 304 Not Modified
response.
ETags
When updating records via the API, Clio's API supports Optimistic Concurrency Control, to ensure that updates from third-party applications do not accidentally overwrite changes that have occurred within Clio.
When you make a PATCH
request, you can provide an If-Match
header with the resource's ETag value. If your provided ETag value matches the current value of the resource's ETag in Clio, it means that you have the latest version of the resource. The update will be safely performed and the API will return a 200 OK
response.
If the ETag values do not match, it means that the resource has changed within Clio since you last retrieved it. As a result, the update will not be performned, and the API will return a 412 Precondition Failed
response. If this occurs, you need to retrieve the latest version of the resource to determine any possible conflicts. Once you've determined you can update safely, you can request your update again, passing the latest ETag value in the If-Match
header.