What REST PUT/POST/DELETE calls should return by a convention?

tuxSlayer picture tuxSlayer · Nov 24, 2010 · Viewed 116.8k times · Source
  1. According to the "REST ideology" what should be in the response body for a PUT/POST/DELETE requests?

  2. What about return codes? Is HTTP_OK enough?

  3. What is the reason for such conventions, if any?

I've found a good post describing POST/PUT differences: POST vs PUT But it still doesn't answer my question.

Answer

Darrel Miller picture Darrel Miller · Nov 24, 2010

Forgive the flippancy, but if you are doing REST over HTTP then RFC7231 describes exactly what behaviour is expected from GET, PUT, POST and DELETE.

Update (Jul 3 '14):
The HTTP spec intentionally does not define what is returned from POST or DELETE. The spec only defines what needs to be defined. The rest is left up to the implementer to choose.