What is the HTTP status return code for a successful DELETE statement in REST?

前端 未结 4 1733
清歌不尽
清歌不尽 2020-12-13 23:39

I am studying how to Spring handle REST web services (but I don\'t know if it is a Spring related answer or more generically it is related only to REST concept).

So

4条回答
  •  Happy的楠姐
    2020-12-14 00:29

    An empty response body doesn't mean that a delete is successful, a successful delete (usually) means that the response body is empty.

    There's no official status code list for RESTful APIs, but most agree that a 204 is a good response code for a successful delete, as there's usually not a good reason to return a response body after deleting something.

    In general, if an operation is successful and the response body is empty return 204. If an operation is successul and the response body is NOT empty, return 200

提交回复
热议问题