ETags
An ETag (entity tag) is an HTTP header that is used to validate that the client (such as a mobile device) has the most recent version of a record. When a GET request is made, the ETag is returned as a response header. The ETag also allows the client to make conditional requests.
In addition to supporting the basic update methods of HTTP PUT and HTTP PATCH, OSLC also supports conditional updates. Conditional updates use HTTP entity tags and If-Match headers to validate whether clients have the most current entity for a resource. This process is used to detect bad updates and race conditions. For example, if two clients load the same resource, OSLC sends the ETag header with the response.
The ETag value is the date and time of the last update to the resource. The client stores the ETag header value and sends it as part of HTTP If-Match header for a subsequent update request. The server evaluates the If-Match header and determines whether the client has an old version or the most recent version of the resource. If the server determines that the client version is old, it sends back an HTTP 412 precondition failed response. The client gets the resource again and submits a request that is based on the updated ETag. However, if the server determines that the client version is the most recent version, the update is implemented unless any business validation or database constraints are found.
The client can also submit the request without the If-Match header or with the If-Match header value set to * (asterisk). Submitting this request is semantically equivalent to having no If-Match header in the update request. In both cases, the update is unconditional. If the resource that is referred by the URI exists and no business validation or database constraints are found, the update is implemented.