REST API 202与204 [英] REST API 202 versus 204

查看:402
本文介绍了REST API 202与204的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我处理一个REST API,并有这样的疑问,当一个请求计划进行进一步的处理,我们应该返回202,当请求没有回应的身体我们应该回到204.我们应该做些什么,当一个请求会在进一步处理,但一直没有回应的身体要么?

I'm dealing with a REST API and have this question, when a request is scheduled for further processing we should return 202, when a request has no response body we should return 204. What should we do when a request will be in processing further, but has no response body either?

在此先感谢!

推荐答案

这将是一个202没有响应主体的之后的处理完成(成功)。

That would be a 202. There is no response body after the processing is complete (and successful).

如果没有办法为它失败,或者客户端不关心失败,客户端不关心动作完成时,则因为没有一点延缓其204将是适当的。

If there is no way for it to fail, or the client doesn't care about failure, and the client doesn't care when the action is complete, then 204 would be appropriate as there's no point in delaying it.

这篇关于REST API 202与204的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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