Having fun with HTTP status codes

Digging beyond 404 and 500 errors, let's take a look at the dozens of status codes of the HTTP protocol -- and at some of the geek humor that’s hidden in their midst

Even non-developers are familiar with the 404 - Not Found status code. Some Web application users may have been exposed to more arcane (and sometimes scary) messages like 500 - Internal Server Error, or 503 - Service Unavailable -- or to application messages that say something like "Sorry dude, there was an error on the server side, your best bet is to try again, or call support".

What we non-developers don't necessarily know is that these messages are part of what is called "HTTP Status Codes", a series of technical statuses that are returned by HTTP servers (such as the ones serving Websites or RESTful APIs) to the client making the request. To make it easier for developers (and non-developers too) to understand what these status codes mean and how to use them, the people at Restlet, a vendor in the API space, have created and published a cool looking metro-style HTTP Status Codes Map. (Disclosure: I am an advisor to Restlet)

And of course, HTTP is not devoid of geek humor -- read till the end to figure out more on that.

Code 100: Informational

With only 3 codes (100, 101, 102), the 100 series is the shortest one. Basically, what it does is return an information message such as "I am working on it". No success or error, just a "Roger that!"

Code 200: Success

A code 200 is the one you want to see the most of in your logs: it means the request was successful. Either it has returned something, or it has returned nothing but successfully completed the processing on the server. It's the server saying: "Here you go". There are 7 variants, from 200 to 206.

Code 300: Redirection

There are no less than 8 codes that mean "I am sending you somewhere else", either temporarily or permanently. These codes are useful when changing content on servers, when one cannot update clients that continue to call the older URLs, and/or to ensure than search engine indexing is not lost.

Code 400: Client Error

A client error is basically the server responding to the client (browser, mobile app, etc.): "You messed up" or more precisely: "I don't really know what you are asking me for". The most famous 400 code, that all Web users have seen, is the ubiquitous 404 - Not Found which is shown by a Web browser when a link is "broken", i.e. the URL does not exist. But there are actually 26 codes in the 400 series, covering all possible details of what the error is, ranging from authorization and permission issues to unexpected/wrong parameters, and even the humoristic 418 - I'm a Teapot and 451 - Unavailable For Legal Reasons (see below).

Code 500: Server Error

The 500 errors are the server counterparts of the 400 client errors. They mean "I messed up" (not your fault). With 11 codes, the series offers a variety of explanations from an unexplained server error to a timeout or to storage issues. It goes without saying that server errors are bad, they need to be logged and examined carefully.

HTTP geek humor

Developers like humor. Restlet's HTTP Status Codes Map is no exception, it is full of funny metro station names. My favorites: OAuth Bazar (I am an open source quasi-geek, of course), Swagger Market, IoT Square and Analytics Road (ah, the smell of big data…) and SOAP Dead End (enough said).

What about the Teapot story? The 418 code was defined in 1998 as one of the traditional IETF April Fools' jokes, as part of the Hyper Text Coffee Pot Control Protocol which states that this code should be returned by teapots requested to brew coffee (thankfully it is not expected to be implemented by actual HTTP servers).

Last but not least, 451 - Unavailable For Legal Reasons, is intended to be used when resource access is denied for legal reasons, e.g. censorship or government-mandated blocked access. It is of course a reference to the novel Fahrenheit 451, where books are outlawed.

Copyright © 2015 IDG Communications, Inc.