When you receive a response from a server, the response will come with a status code and its corresponding status text.
This status code and text give you a hint about what the response is.
Status code classifications
Status codes are grouped into 5 classes:
| Code | Classification |
|---|---|
100 – 199 |
Informational responses |
200 – 299 |
Successful responses |
300 – 399 |
Redirection responses |
400 – 499 |
Client error messages |
500 – 599 |
Server error messages |
You can find a list of all available status codes and status text here.
You don’t have to remember all the status codes because their accompanying status text gives you enough information to understand what’s wrong.
What you have to know
Here are the most important statuses you need to know:
| Code | Status Text | Meaning |
|---|---|---|
200 |
OK | Response is successful |
400 |
Bad Request | There’s a client error — this means you’ve sent data that the request doesn’t agree with. So you need to check the data you’ve sent. |
401 |
Unauthorized | You need to be authenticated to access the content. If you’re authenticating, it means your credentials are incorrect. |
403 |
Forbidden | You don’t have the rights to access the content (even if you are authenticated). This is usually a permissions issue. |
404 |
Not Found | Endpoint is not found. You have to check your endpoint and make sure you used the right one. |
500 |
Internal Server Error | An error has occurred in the server and there’s nothing much you can do about it (except contact support). |
Some APIs send over a 200+ status code even if the response is an error message.
If you use these APIs, you have to pay attention to these cases and handle the errors accordingly.
That’s all you need to know about HTTP statuses for now!
Next, let’s talk about response headers.
Welcome! Unfortunately, you don’t have access to this lesson. To get access, please purchase the course or enroll in Magical Dev School.
Unlock this lesson