We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ODataV4 custom adaptor headers ETag

Thread ID:





128485 Jan 25,2017 01:45 PM UTC Jan 30,2017 11:38 AM UTC ASP.NET MVC 5
Tags: DataManager
Emanuele Filardo
Asked On January 25, 2017 01:45 PM UTC

Hi, my ODataV4 service expose ETag value in @odata.etag field, how can I set his value in request headers?

var customAdaptor = new ej.ODataV4Adaptor().extend({ 
            update: function (dm, keyField, value, tableName) { 
                return { 
                    type: "PATCH", 
                    url: dm.dataSource.url.replace(/\/*$/, tableName ? '/' + tableName : '') + '(\'' + value[keyField] + '\')', 
                    data: JSON.stringify(value), 
                    accept: this.options.accept,
                    headers: { "If-Match": VALUE_OF_ETAG }


Karthikeyan Viswanathan [Syncfusion]
Replied On January 26, 2017 04:14 PM UTC

Hi Emanuele Filardo  
Thanks for contacting Syncfusion support. 
 Please try the below code into your sample: 
var customAdaptor = new ej.ODataV4Adaptor().extend({  
            update: function (dm, keyField, value, tableName) { 
                                      dm.dataSource.headers =[{ “If-Match”: VALUE_OF_ETAG }]; 
                return {  
                    type: "PATCH",  
                    url: dm.dataSource.url.replace(/\/*$/, tableName ? '/' + tableName : '') + '(\'' + value[keyField] + '\')',  
                    data: JSON.stringify(value),  
                    accept: this.options.accept 
Karthikeyan V.  

Emanuele Filardo
Replied On January 26, 2017 04:27 PM UTC

Hi, I have problem to get VALUE_OF_ETAG, in the grid I've tried to add odata.etag but is recognized as an "expand" request, and in "value" object is not present.

This is the metadata: {"@odata.context":"https://localhost:44300/api/easycaregiverapi/$metadata#Assistiti","value":[{"@odata.etag":"W/\"YmluYXJ5J0FBQUFBQUFBQ09zPSc=\"","...

Prince Oliver [Syncfusion]
Replied On January 27, 2017 11:52 AM UTC

Hi Emanuele,   
Thanks for your update.   
We were unable to replicate your scenario at our end. Please provide us an issue reproducible sample or code snippet along with replication steps, it will help us provide you a solution.   
If you are looking for accessing the header at server side, refer to the below code snippet.   

Emanuele Filardo
Replied On January 28, 2017 01:59 PM UTC

I've found a solution, but I don't know if is the right way:
headers: { "If-Match": args.model.selectedRecords[0]["@@odata.etag"] }

Prince Oliver [Syncfusion]
Replied On January 30, 2017 11:38 AM UTC

Hi Emanuele,     
Thanks for your update.     
Yes, you can set the value of “odata.etag” to “if-Match” in the header as per your shared code. Also, you can use the datasource headers “dm.dataSource.headers”  as mentioned in previous update to set value of “odata.etag”    


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon