Show TOC

ETag HandlingLocate this document in the navigation structure

Use

SAP Gateway offers generic support of ETag (conditions) handling. ETags or entity tags are part of the HTTP protocal. They are header fields that help to determine changes of a resource and can be used in caching scenarios, so that redundant data transfer can be minimized. ETag handling is one of several mechanisms that HTTP thus provides for web cache validation, and which allows a client to make conditional requests. OData uses HTTP ETags for optimistic concurrency control.

ETag support in SAP Gateway is provided on both hub and backend. Thus, both hub and backend applications can enhance or modify the generic check. Backend operations can also override the generic conditional handling for data modification requests, such as PUT, MERGE and DELETE, on the backend.

A few special considerations apply for ETags:

  • When retrieving an entry the server returns an opaque ETag value

    • When getting several entries in a feed, the ETag value is included as metadata in the entry itself.

    • When retrieving a single entry, the ETag is returned as a response header called ETag as defined by HTTP. The server can choose to also include it in the body as they would do for feeds for consistency.

    • During processing of POST, PUT and MERGE the server should compute a new ETag and return it in a response header, regardless of whether the response has a body with the actual entry information.

  • When issuing a PUT, MERGE or DELETE request, clients need to indicate an ETag in the If-Match HTTP request header.

    • If it is acceptable for a given client to overwrite any version of the entry in the server, then the value "*" may be used instead.

    • If a given entry has an ETag and a client attempts to modify or delete the entry without an If-Match header servers should fail the request with a 412 response code.

OData servers will often use weak ETags as a way of indicating that two resources may be semantically equivalent but a particular request may see a different representation of it.

The following interfaces provide methods for ETag handling: