【发布时间】:2023-03-10 12:25:01
【问题描述】:
我正在设计一个端点,客户端将点击该端点向应用程序注册租户;这些租户表示为子域 (<subdomain>.alex.com)。我想保留所有长度
400 似乎还可以,但我想知道是否有更好的。
一个想法是422:
422 Unprocessable Entity
The 422 (Unprocessable Entity) status code means the server
understands the content type of the request entity (hence a
415(Unsupported Media Type) status code is inappropriate), and the
syntax of the request entity is correct (thus a 400 (Bad Request)
status code is inappropriate) but was unable to process the contained
instructions. For example, this error condition may occur if an XML
request body contains well-formed (i.e., syntactically correct), but
semantically erroneous, XML instructions.
【问题讨论】:
-
“语义错误”听起来是使用 422 的好理由。
标签: rest http-status-code-400 http-response-codes