什么REST PUT / POST / DELETE调用应按惯例返回? [英] What REST PUT/POST/DELETE calls should return by a convention?

查看:129
本文介绍了什么REST PUT / POST / DELETE调用应按惯例返回?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  1. 根据REST意识形态,PUT / POST / DELETE请求的响应正文应该是什么?

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

返回代码怎么样?是 HTTP_OK 够吗?

What about return codes? Is HTTP_OK enough?

这些约定的原因是什么?

What is the reason for such conventions, if any?

我发现了一篇描述POST / PUT差异的好文章: POST vs PUT
但它仍然无法回答我的问题。

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.

这篇关于什么REST PUT / POST / DELETE调用应按惯例返回?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆