Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Execute delete request using payload

divyanarayanan94
Discoverer
2,243

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!

2 REPLIES 2
Read only

CarlosRoggan
Product and Topic Expert
Product and Topic Expert
1,703

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

Read only

Former Member
0 Likes
1,703

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