1

This is my Rest service to update list item

URL:
    https://site/_api/lists/getbytitle('Test')/items(49)

Header 
   X-RequestDigest   :   some unique id from contextinfo post service
   Content-Type      :   application/json;odata=verbose 
   X-HTTP-Method     :   MERGE  
   IF-MATCH          :   49

Body 
   {"__metadata":{"type":"SP.Data.TestListItem"},"Title":"Title all1","Option1":"Updated 2"}

When I run this URL in post man I get an error:

The request ETag value '__metadata.etag' does not match the object's ETag value '\"8\"'

But If I change IF-MATCH value in header as *, It's updating properly. Why I am getting an error if use etag ?

2

About eTag

When updating or deleting items within SharePoint lists via REST you must specify the Entity Tag (eTag) value that was returned with the item during the initial query. This enables SharePoint to determine if the item has changed since it was requested. Alternatively you can tell SharePoint to perform the operation regardless by specifying * as the eTag value. For example:

  • If-Match: item.__metadata.etag can be used to specify the actual eTag value (‘item’ is the object returned from SharePoint containing
    the list item in JSON format).
  • If-Match: * can be used to match any eTag value resulting in the operation being performed regardless of the actual value.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.