For input validation failure: 400 Bad Request + your optional description.
(对于输入验证失败: 400错误的请求 +您的可选描述。)
This is suggested in the book " RESTful Web Services ". (在“ RESTful Web服务 ”一书中建议这样做。)
For double submit: 409 Conflict (对于双重提交: 409冲突)
Update June 2014
(2014年6月更新)
The relevant specification used to be RFC2616 , which gave the use of 400 (Bad Request) rather narrowly as
(相关的规范曾经是RFC2616 ,它给出了400(错误请求)的使用范围,)
The request could not be understood by the server due to malformed syntax
(由于语法格式错误,服务器无法理解该请求)
So it might have been argued that it was inappropriate for semantic errors.
(因此, 可能有人认为它不适合语义错误。)
But not any more; (但是没有更多了。)
since June 2014 the relevant standard RFC 7231 , which supersedes the previous RFC2616, gives the use of 400 (Bad Request) more broadly as (自2014年6月起,相关标准RFC 7231 (取代了先前的RFC2616 )在以下方面更广泛地使用了400(错误请求) :)
the server cannot or will not process the request due to something that is perceived to be a client error
(由于某些原因,服务器无法或将不会处理请求,因为这被视为客户端错误)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…