Middle
What HTTP status should be returned upon successful object creation?
sobes.tech AI
Answer from AI
When an object is successfully created, HTTP usually returns a status 201 Created. This status indicates that the request was successful and a new resource was created as a result. It is often accompanied by a Location header with the URL of the created object.
Example response headers:
HTTP/1.1 201 Created
Location: https://api.example.com/items/123
Content-Type: application/json
This allows the client to immediately obtain a link to the new resource.