RESTful - What should a DELETE response body contain

tmuecksch picture tmuecksch · Sep 22, 2014 · Viewed 63.2k times · Source

Let's say I have an API where you can get users:

GET /RESTAPI/user/

And you can delete users by:

DELETE /RESTAPI/user/123

What is the RESTful convention on what the DELETE's response body should contain? I expected it should be the new list of all users which now doesn't contain the user with id 123 anymore.

Googling around didn't get me any satisfying answers. I only found opinions on how to do that, but isn't there a strict definition of RESTful Services?

This is NOT a duplicate of What should a RESTful API POST/DELETE return in the body? and What REST PUT/POST/DELETE calls should return by a convention? since this questions asks for a strict definition regarding DELETE. Those questions were only answered by loose opinions only.

Answer

Leon picture Leon · Sep 22, 2014

The reason you get no hard answers is because there is no hard RESTful standard. So I can only suggest that you create a hard standard and stick to it within your own APIs

I used this as a guide for RESTful services http://www.vinaysahni.com/best-practices-for-a-pragmatic-restful-api

It says respond with a 204 status and an empty body

I stick to those standards and document them well for anyone who wants to use my APIs