Etag value not valid on PUT request

Question Status

Verified
jorgeCC asked a question on 19 Jun 2017 9:46 AM

Hello,

i am having problems trying to update records through NAV 2015 OData WS.

I am getting: "The etag value '28;X8MAAAJ7/0EARAAwADAAMQAAAAAA9;7238058930;' specified in one of the request headers is not valid. Please make sure only one etag value is specified and is valid."

This is what i get if i do a GET:

GET   http://*******:****/****/Odata/Company('***')/Socios('AD001')?$format=json

{
"odata.metadata": "http://*********.es:****/******/OData/$metadata#Socios/@Element",
"N_x00BA_": "AD001",
"Nombre": "JESUS",
"ETag": "28;X8MAAAJ7/0EARAAwADAAMQAAAAAA9;7238058930;"
}


I am trying to update with this call:


PUT http://********.*****.es:****/*****/Odata/Company('****')/Socios('AD001') HTTP/1.1 Accept-Encoding: gzip,deflate Authorization: Basic bGlmZXVzZXI6QXRhbWExYXRhbWEx OData-MaxVersion: 4.0 OData-Version: 4.0 If-Match: 28;X8MAAAJ7/0EARAAwADAAMQAAAAAA9;7238058930; Content-Type: application/json Accept: application/json Content-Length: 107 Host: **********.*****.es:**** Connection: Keep-Alive User-Agent: Apache-HttpClient/4.1.1 (java 1.5) { "N_x00BA_": "AD001", "Nombre": "JESUS", "ETag": "28;X8MAAAJ7/0EARAAwADAAMQAAAAAA9;7238058930;" }

Can i get some help?

Thx you very much.

Reply
Verified Answer
jorgeCC responded on 20 Jun 2017 3:13 AM

I found the solution:

The If-math header must have this format:

W / " ' EtagValue ' "

In my example: If-Match: W/"'28;X8MAAAJ7/0EARAAwADAAMQAAAAAA9;7238058930;'"

Reply
Verified Answer
jorgeCC responded on 20 Jun 2017 3:13 AM

I found the solution:

The If-math header must have this format:

W / " ' EtagValue ' "

In my example: If-Match: W/"'28;X8MAAAJ7/0EARAAwADAAMQAAAAAA9;7238058930;'"

Reply