What could be simpler than returning HTTP status codes? Did the page render? Great, return
200. Does the page not exist? That’s a
404. Do I want to redirect the user to another page?
302, or maybe
I like to imagine that HTTP status codes are like CB 10 codes. “Breaker breaker, this is White Chocolate Thunder. We’ve got a 200 OK here.”
— Aaron Patterson (@tenderlove) October 7, 2015
Life is bliss, well… until someone tells you you’re not doing this REST thing. Next thing you know, you can’t sleep at night because you need to know if your new resource returns the RFC-compliant, Roy-Fielding-approved status code. Is it just a
200 here? Or should it really be a
204 No Content? No, definitely a
202 Accepted… or is that a
What complicates matters is that the official HTTP/1.1 guidelines — the RFC — was originally written in 1997.† That’s the year you went surfing the cyberweb in Netscape Navigator on your 33.6kbps modem. It’s a little like trying to apply Sun Tzu’s Art of War to modern business strategy. Timeless advice, to be sure, but I haven’t yet figured out how The Five Ways to Attack With Fire are going to help me do market validation.