RESTful - What should a DELETE response body contain

后端 未结 3 1545
北海茫月
北海茫月 2021-01-30 15:27

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
         


        
3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-30 16:18

    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

提交回复
热议问题