开发者

What is the status code I return on an API when a parameter passed does not meet requirements?

Let's say the pers开发者_Go百科on passed in "5", when the parameter must be 0 or 1.


I would actually suggest 400 (Bad Request) which is typically used for cases like this. More information is usually returned as payload (to indicate which parameter was at fault, with possible acceptable value range etc).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜