Http Invalid Input Error Code
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings http status code 422 and policies of this site About Us Learn more about Stack Overflow
Rest Http Status Codes Best Practices
the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation
Wrong Answer Code From Api Ifunny
Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it
Apis Status Invalid Austrian Airlines
only takes a minute: Sign up REST HTTP status codes for failed validation or invalid duplicate up vote 459 down vote favorite 128 I'm building an application with a REST-based API and have come to the point where i'm specifying status codes for each requests. What status code should i send for requests failing validation or where a request is trying http status code invalid parameter to add a duplicate in my database? I've looked through http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html but none of them seems right. Is there a common practice when sending status codes? http rest http-status-codes share|improve this question edited Sep 3 '14 at 15:02 Raedwald 17.6k1265104 asked Jul 20 '10 at 13:03 alexn 33.7k878119 3 See: stackoverflow.com/questions/1959947/… –deamon Jul 20 '10 at 13:39 6 Open httpstatus.es, Right Click >> Pin Tab :P –Salman Abbas May 24 '12 at 5:00 add a comment| 7 Answers 7 active oldest votes up vote 412 down vote accepted For input validation failure: 400 Bad Request + your optional description. This is suggested in the book "RESTful Web Services". For double submit: 409 Conflict Update June 2014 The relevant specification used to be RFC2616, which gave the use of 400 (Bad Request) rather narrowly as 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 RF
consisting only of the Status-Line and optional headers, and is terminated by an empty line. There are no required headers for this class of status code. Since HTTP/1.0 did not define any 1xx rfc 4918 status codes, servers MUST NOT send a 1xx response to an HTTP/1.0 client except http status code 400 under experimental conditions. A client MUST be prepared to accept one or more 1xx status responses prior to a regular response, even 400 vs 422 if the client does not expect a 100 (Continue) status message. Unexpected 1xx status responses MAY be ignored by a user agent. Proxies MUST forward 1xx responses, unless the connection between the proxy and its client has http://stackoverflow.com/questions/3290182/rest-http-status-codes-for-failed-validation-or-invalid-duplicate been closed, or unless the proxy itself requested the generation of the 1xx response. (For example, if a proxy adds a "Expect: 100-continue" field when it forwards a request, then it need not forward the corresponding 100 (Continue) response(s).) Wikipedia Request received, continuing process. This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line. Since HTTP/1.0 did not define http://www.restapitutorial.com/httpstatuscodes.html any 1xx status codes, servers must not send a 1xx response to an HTTP/1.0 client except under experimental conditions. 100 Continue The client SHOULD continue with its request. This interim response is used to inform the client that the initial part of the request has been received and has not yet been rejected by the server. The client SHOULD continue by sending the remainder of the request or, if the request has already been completed, ignore this response. The server MUST send a final response after the request has been completed. See section 8.2.3 for detailed discussion of the use and handling of this status code. Wikipedia This means that the server has received the request headers, and that the client should proceed to send the request body (in the case of a request for which a body needs to be sent; for example, a POST request). If the request body is large, sending it to a server when a request has already been rejected based upon inappropriate headers is inefficient. To have a server check if the request could be accepted based on the request's headers alone, a client must send Expect: 100-continue as a header in its initial request and check if a 100 Continue status code is received in response before continuing (or rece
response. 10.1 Informational 1xx This class of status code indicates a provisional response, consisting only of the Status-Line and optional headers, and is terminated by an empty line. There are no required headers for this https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html class of status code. Since HTTP/1.0 did not define any 1xx status codes, servers MUST NOT send a 1xx response to an HTTP/1.0 client except under experimental conditions. A client MUST be prepared to accept one or more 1xx status responses prior to a regular response, even if the client does not expect a 100 (Continue) status message. Unexpected 1xx status responses MAY be ignored by a user agent. Proxies http status MUST forward 1xx responses, unless the connection between the proxy and its client has been closed, or unless the proxy itself requested the generation of the 1xx response. (For example, if a proxy adds a "Expect: 100-continue" field when it forwards a request, then it need not forward the corresponding 100 (Continue) response(s).) 10.1.1 100 Continue The client SHOULD continue with its request. This interim response is used to inform http status code the client that the initial part of the request has been received and has not yet been rejected by the server. The client SHOULD continue by sending the remainder of the request or, if the request has already been completed, ignore this response. The server MUST send a final response after the request has been completed. See section 8.2.3 for detailed discussion of the use and handling of this status code. 10.1.2 101 Switching Protocols The server understands and is willing to comply with the client's request, via the Upgrade message header field (section 14.42), for a change in the application protocol being used on this connection. The server will switch protocols to those defined by the response's Upgrade header field immediately after the empty line which terminates the 101 response. The protocol SHOULD be switched only when it is advantageous to do so. For example, switching to a newer version of HTTP is advantageous over older versions, and switching to a real-time, synchronous protocol might be advantageous when delivering resources that use such features. 10.2 Successful 2xx This class of status code indicates that the client's request was successfully received, understood, and accepted. 10.2.1 200 OK The request has succeeded. The information returned with the response is dependent