Question

While working on recent REST apis I had a question that why "IANA" decided to have HTTP status code from 100 only and not from 1. I hope there will be a reason behind it but I am curious to know about that.

Was it helpful?

Solution

HTTP/1.0 added status codes to HTTP/0.9, the initially released version. The status code range is defined as such:

RFC 1954, 6.1.1 Status Code and Reason Phrase

The Status-Code element is a 3-digit integer result code of the attempt to understand and satisfy the request[...]. The Status-Code is intended for use by automata[...].

The first digit of the Status-Code defines the class of response. The last two digits do not have any categorization role. There are 5 values for the first digit:

  • 1xx: Informational - Not used, but reserved for future use
  • 2xx: Success - The action was successfully received, understood, and accepted.
  • 3xx: Redirection - Further action must be taken in order to complete the request
  • 4xx: Client Error - The request contains bad syntax or cannot be fulfilled
  • 5xx: Server Error - The server failed to fulfill an apparently valid request

As for the "why": it allows for five categories, each of which can contain a hundred different codes (x00 - x99), which "ought to be enough for anybody".

OTHER TIPS

The status codes are not numbered in a consecutive manner. The first digit indicates the type of status code, e.g. 2xx for success and 4xx for client error. The last to digits are used to specify the status code more. Two digits are needed because more then 9 status codes per type exists.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top