2020 Aug 19 8:02 AM
Hello,
Please let me know if it is possible to pass payload while executing a delete request in Odata.
I have a requirement where I need to validate & update few values in table ( based on the values passed from payload) and then process the delete request.
Thanks in advance!
2020 Aug 19 8:22 AM
Hi,
DELETE requests usually are sent with no payload.
The OData Spec says, "should" be empty
But even if not forbidden, I assume no OData library would handle a payload in DELETE request
I guess, unforeseen data mismatch can occur between server and client if the contract of DELETE is not clear, in the sense that data is removed without changing the state
In your use case, maybe you can use custom header for sending additional info?
Or even custom URL param?
Kind Regards,
Carlos
2020 Aug 19 7:26 PM
Hello,
It’s not possible to use payload in delete request and you can do few tweaks like use update request instead of delete and within class method first validate and update values and then go for delete code. You can think of using function imports.
Many times we get requirement where we cannot use standard processes for CRUD as dictated by guidelines. In such scenarios we have to tweak standard process as per our requirement. I know it’s not best way but sometime have to go for it because of no other option.
Thanks,
Dhiraj M