Skip to main content
Solved

How to Restful delete method works?

  • November 15, 2022
  • 2 replies
  • 673 views

hhy38
Superhero (Customer)
Forum|alt.badge.img+16
  • Superhero (Customer)
  • 326 replies

I am practicing on Restful Apis. I can use Get and Post methods. However, I couldn’t use the Delete method. I added the If-Match parameter to the header. I tried “*” as the value, I tried with etag value. I couldn’t solve the problem. The error message is “ORA-20100: Error.ODATA_TO_PLSQL_PROTOCOL: ETag must have a valid value, was [*]” How can I delete a record?

 

Example

Projection: main/ifsapplications/projection/v1/EmployeesHandling.svc

 

I can Post gender.

I can Get the gender.

I can’t Delete the gender.

 

Best answer by Technical Outlaws

For the etag, make sure you remove the \ character in the actual string, as this is used to handle the “ in JSON.

 

For example, take the following etag from a Get request.

"@odata.etag": "W/\"Vy8iOTBDODc5RTQ4NzkxNDZCQkIyRkU5RTQ3M0U3RUU2NUI6MjAyMDA2MjUwOTA3MTQi\""

 

The actual etag string to use in the If-Match header parameter.

W/"Vy8iOTBDODc5RTQ4NzkxNDZCQkIyRkU5RTQ3M0U3RUU2NUI6MjAyMDA2MjUwOTA3MTQi"

2 replies

Technical Outlaws
Hero (Employee)
Forum|alt.badge.img+11
  • Hero (Employee)
  • 150 replies
  • Answer
  • November 16, 2022

For the etag, make sure you remove the \ character in the actual string, as this is used to handle the “ in JSON.

 

For example, take the following etag from a Get request.

"@odata.etag": "W/\"Vy8iOTBDODc5RTQ4NzkxNDZCQkIyRkU5RTQ3M0U3RUU2NUI6MjAyMDA2MjUwOTA3MTQi\""

 

The actual etag string to use in the If-Match header parameter.

W/"Vy8iOTBDODc5RTQ4NzkxNDZCQkIyRkU5RTQ3M0U3RUU2NUI6MjAyMDA2MjUwOTA3MTQi"


hhy38
Superhero (Customer)
Forum|alt.badge.img+16
  • Author
  • Superhero (Customer)
  • 326 replies
  • November 16, 2022

That is perfect. Very smartly. Thank you @Technical Outlaws . I wasn’t thinking of “\” as an escape character. Is it written in the technical documentation?