什么REST PUT / POST / DELETE调用应该按惯例返回?(What REST PUT/POST/DELETE calls should return by a convention?)

编程入门 行业动态 更新时间:2024-10-28 16:21:29
什么REST PUT / POST / DELETE调用应该按惯例返回?(What REST PUT/POST/DELETE calls should return by a convention?)

根据“REST意识形态”,在响应体中应该有一个PUT / POST / DELETE请求?

返回代码怎么办? HTTP_OK是否足够?

这些公约的原因是什么?

我发现一个很好的帖子描述POST / PUT的差异: POST vs PUT但它仍然没有回答我的问题。

According to the "REST ideology" what should be in the response body for a PUT/POST/DELETE requests?

What about return codes? Is HTTP_OK enough?

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.

最满意答案

原谅轻松,但如果您通过HTTP进行REST,则RFC7231将准确描述GET,PUT,POST和DELETE的预期行为。

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.

更多推荐

PUT,POST,HTTP_OK,DELETE,电脑培训,计算机培训,IT培训"/> <meta name="descr

本文发布于:2023-04-27 14:54:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1327329.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:按惯例   POST   REST   PUT   DELETE

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!