Should I make up my own HTTP status codes? (a la Twitter 420: Enhance Your Calm)

Posted by Max Bucknell on Programmers See other posts from Programmers or by Max Bucknell
Published on 2013-11-10T23:47:13Z Indexed on 2013/11/11 4:11 UTC
Read the original article Hit count: 201

Filed under:
|

I'm currently implementing an HTTP API, my first ever.

I've been spending a lot of time looking at the Wikipedia page for HTTP status codes, because I'm determined to implement the right codes for the right situations. Listed on that page is a code with number 420, which is a custom code that Twitter used to use for rate limiting.

There is already a code for rate limiting, though. It's 429.

This led me to wonder why they would set a custom one, when there is already a use case. Is that just being cute? And if so, then which circumstances would make it acceptable to return a different status code, and what, if any problems may clients have with it?

I read somewhere that Mozilla doesn't implement the joke 418: I’m a teapot response, which makes me think that clients choose which status codes they implement. If that's true, then I can imagine Twitter's funny little enhance your calm code being problematic.

Unless I'm mistaken, and we can appropriate any code number to mean whatever we like, and that only convention dictates that 404 means not found, and 429 means take it easy.

© Programmers or respective owner

Related posts about api-design

Related posts about http