HTTP 201 status code
What is HTTP ?
HTTP stands for Hyper Text Transfer Protocol. Using this protocols, the clients communicate with server and vice versa. This concept is the core of internet, since it was created in 1990. HTTP is basic yet powerful file transfer protocol.
Features of HTTP:
- HTTP is connectionless: This means that HTTP needs a continuous connection with the server to transfer files. In this case, the client sends the request and that request is processed by the server and a response is sent back. The connection is established when the request is sent and connection ends once the response is returned, after this neither the client nor the server is aware of each other.
- HTTP is stateless: It is called stateless because once the request and response cycle between the client and the server is finished neither the server nor the client retain the information between different requests across multiple websites. Simply what happens within a request and response cycle won’t affect any request in the future since all the requests are independent of each other.
- HTTP is independent of type of file used: HTTP can be used to transfer any type of data, provided that the client and the server can handle that format of data.
HTTP status codes: The HTTP status codes are used to indicate that any specific HTTP request has successfully completed or not. The HTTP status codes are categorized into five sections those are listed below:
- Informational responses (100–199)
- Successful responses (200–299)
- Redirects (300–399)
- Client errors (400–499)
- Server errors (500–599)
HTTP response codes: As we have already seen, the workflow of a HTTP request, we know that the client sends the request and the server sends the response which is generally a JSON data or HTML, CSS files. This response is accompanied by a response status code that helps us to classify the type of response received and the status of the request processed.
What is HTTP response code 201: The response code of the format 2XX indicates success.The response code of 201 is hence a success status code that indicates that a new resource has been created. The new resource is effectively created before this response code is sent back and the new resource is returned to the body of the message. Its location being either the URL of the request, or the content of the location header. It is used most of the time with a POST request to create new users or articles using a web form.