ETag value is a part of the HTTP protocol that allows concurrency control and web cache validation. ETag is a broader topic when considered in general, but the main focus on this article is to discuss about REST API usage within SharePoint. ETag value is used whenever we make a POST request to a REST API endpoint. This is handled through the IF-Match request header. A sample request is displayed below.
So now lets see how this header works. Once we make a GET request, we receive an ETag value as a part of the meta data as you can see in the image below.
This is a numeric value and it represent the resource version of the resource at the time the GET request is made. Given these data can be accessed by many users within the same time, there can be a difference of the data by the time a user attempts to update. (Simple concurrency issue). With ETag value we can check whether the values do match each other by the time the update operation is performed. If the values match, an update will be performed. If not, an error will be returned as follows.
How to Handle this?