开发者

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

开发者 https://www.devze.com 2023-02-06 03:56 出处:网络
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 usuall

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

精彩评论

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