Twenty-one HTTP status codes worth knowing, grouped by class - because the class is most of the…
Twenty-one HTTP status codes worth knowing, grouped by class - because the class is most of the value.
1xx Informational
100 Continue - 101 Switching Protocols
2xx Success
200 OK - 201 Created - 202 Accepted - 204 No Content
3xx Redirection
301 Moved Permanently - 302 Found - 304 Not Modified - 307 Temporary Redirect
4xx Client Errors
400 Bad Request - 401 Unauthorized - 403 Forbidden - 404 Not Found - 405 Method Not Allowed - 429 Too Many Requests
5xx Server Errors
500 Internal Server Error - 501 Not Implemented - 502 Bad Gateway - 503 Service Unavailable - 504 Gateway Timeout
If you remember nothing else: 4xx is the caller's fault, 5xx is yours.
Two pairs get confused constantly. 401 means UNAUTHENTICATED - who are you? 403 means unauthorised - I know exactly who you are and the answer is still no. The registry name for 401 is literally "Unauthorized", which is precisely why people get it backwards.
And 301 is permanent and cached forever by browsers. Shipping a 301 by mistake is one of the very few HTTP errors you cannot take back. Use 302 or 307 unless you are certain.
Every reason phrase here is the IANA registry wording, checked rather than remembered.
Save this one.
Full interactive lab →
#http #api #backend #webdev #systemdesign
Music: "Undaunted" by Kevin MacLeod (incompetech.com)
Licensed under Creative Commons: By Attribution 4.0
Comments
Comments from the original post on Instagram
No comments yet
