Course Content
Django REST Framework
1. What is the Rest API ?
4. HTTP Request Methods
Django REST Framework
HTTP Response Status Codes
HTTP response status codes are standard codes returned by web servers in response to a client's request made to the server. These status codes provide information about the outcome of the request, indicating whether it was successful, encountered an error, or requires further action.
Status Code Range | Description |
---|---|
100 – 199 | Informational responses |
200 – 299 | Successful responses |
300 – 399 | Redirection messages |
400 – 499 | Client error responses |
500 – 599 | Server error responses |
Why Use HTTP Response Status Codes Logs?
HTTP Response Status Codes logs can be utilized for:
- Problem Detection: Logs aid in identifying which URLs on your website are generating errors;
- Troubleshooting: Logs help understand the reasons for HTTP errors;
- Performance Tracking: Logs are useful for tracking website performance and identifying potential issues that could impede its operation;
- User Behavior Analysis: Logs can be used to analyze user interaction with your website, including visited pages and encountered errors.
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/2094862b-414e-43a2-b303-58f071838bf6/Section+4/b17da956-2ce9-43c4-8123-6159fd9c8284_status_codes.png)
Code Description
Status code 200: This means "OK". When the client receives a response with a status code of 200, it indicates that the request was successfully executed. This can be used for GET requests that successfully return the requested data. For example, if you request a webpage and it loads successfully, the server may send a status code 200;
Status code 404: This means "Not Found". When the client receives a response with a status code of 404, it indicates that the requested resource was not found on the server. For example, if you enter a URL in the browser and it returns a status code 404, it means that the resource does not exist on the server.
So, in short, status code 200 indicates a successful response, while status code 404 indicates that the requested resource was not found.
By default, Django logs to the console. You can start the Django test server using the command python manage.py runserver
and see the logs in the console.
Everything was clear?
Course Content
Django REST Framework
1. What is the Rest API ?
4. HTTP Request Methods
Django REST Framework
HTTP Response Status Codes
HTTP response status codes are standard codes returned by web servers in response to a client's request made to the server. These status codes provide information about the outcome of the request, indicating whether it was successful, encountered an error, or requires further action.
Status Code Range | Description |
---|---|
100 – 199 | Informational responses |
200 – 299 | Successful responses |
300 – 399 | Redirection messages |
400 – 499 | Client error responses |
500 – 599 | Server error responses |
Why Use HTTP Response Status Codes Logs?
HTTP Response Status Codes logs can be utilized for:
- Problem Detection: Logs aid in identifying which URLs on your website are generating errors;
- Troubleshooting: Logs help understand the reasons for HTTP errors;
- Performance Tracking: Logs are useful for tracking website performance and identifying potential issues that could impede its operation;
- User Behavior Analysis: Logs can be used to analyze user interaction with your website, including visited pages and encountered errors.
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/2094862b-414e-43a2-b303-58f071838bf6/Section+4/b17da956-2ce9-43c4-8123-6159fd9c8284_status_codes.png)
Code Description
Status code 200: This means "OK". When the client receives a response with a status code of 200, it indicates that the request was successfully executed. This can be used for GET requests that successfully return the requested data. For example, if you request a webpage and it loads successfully, the server may send a status code 200;
Status code 404: This means "Not Found". When the client receives a response with a status code of 404, it indicates that the requested resource was not found on the server. For example, if you enter a URL in the browser and it returns a status code 404, it means that the resource does not exist on the server.
So, in short, status code 200 indicates a successful response, while status code 404 indicates that the requested resource was not found.
By default, Django logs to the console. You can start the Django test server using the command python manage.py runserver
and see the logs in the console.
Everything was clear?