Status Codes Flashcards
200
Ok
201
created
204
No content
400
Bad request
-sending bad data to the server
401
Unauthorized
-Didn’t provide correct credentials.
( We don’t know you. )
403
Forbidden
-you do not have permission to take this action.
( We know who you are but you don’t have permission. )
404
Not Found
the resource you are looking for doesn’t exist
405
Method not allowed
-can not perform this http method on this endpoint
For Example:
POST /user/15 when user already exists
406
Not Acceptable
-Endpoint only supports getting the response in certain format and we asked for a format that was not allowed.
415
Unsupported
-server is expecting to get the body in certain content-type, but client sent unsupported content-type.
500
Internal Server Error
- the server encountered an unexpected condition that prevented it from fulfilling the request.
5xx codes happen when the backend code doesn’t have any error handling for incorrect body/unsupported header, so server doesn’t know what to do with it and throws 500 error.
503
Service Unavailable
-the server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay
What is 401?
401 means the wrong credentials were provided
server doesn’t know who you are
What’re the difference between 200 and 400 codes
200 codes are typically success codes where as 400 codes indicate a client side error built into the server. Wrong inputs the server understands, catchs, and throws bacl
What are 400 and 500 response codes?
400 Bad request - means you sent incorrect data and the server has built in error handling for this scenario
500 Internal server error - means you send incorrect data like 400 however the server doesn’t have built in error handling for the scenario.