HTTP status codes are numerical indicators that show how a request from the client was handled by the server. Each code indicates whether the request was successful, contained errors, or requires further action.
200 â OK The request was successfully processed, and the server returned the expected response. Example: When requesting a product list, the server returns the list in JSON format.
201 â Created The request was successful, and the server created a new resource. Example: Submitting a registration form that results in a new user being created.
400 â Bad Request The request is invalid, incomplete, or cannot be understood by the server. Example: Submitting a form with required fields left empty.
401 â Unauthorized Authentication has not been provided or is invalid. Valid credentials are required for access. Example: Sending a request to a protected API without logging in.
403 â Forbidden Authentication is provided but the user does not have permission to access the resource. Example: A regular user attempting to access the admin panel.
404 â Not Found The requested resource could not be found on the server. Example: Navigating to a non-existent URL.
500 â Internal Server Error The server encountered an unexpected error while processing the request. Example: A coding error or a database connection failure.
â Summary:
2xx â Successful operations
4xx â Client-side errors
5xx â Server-side errors
Top comments (0)