HTTP status code 201 “Created” is a success status code indicating that the request has been successfully processed by the server and a new resource has been created. This status code is typically returned for POST requests when the result of the request is the creation of a new resource on the server.
For example, if you send a POST request to a URI and the server receives the content and creates a new resource (such as a database entry or file), the server will return status code 201.
The response for a 201 status code must include a Location header, which contains the URI of the newly created resource. This allows the client to retrieve, view, or further manipulate this new resource.
Here is a simple example of an HTTP response that includes status code 201 Created:
HTTP/1.1 201 Created
Content-Type: text/plain
Content-Length: 0
Location: /new-resource
In this example, the status code 201 indicates that the request was successful and a new resource has been created. The Location header provides the URI of the new resource. The response body is empty, as typically, the newly created resource can be retrieved using the URI specified in the Location header.
If you are using WebDAV (Web Distributed Authoring and Versioning) or similar protocols, the 201 status code can also indicate that a property of an existing resource (such as an extended attribute of a file) has been successfully created.