Problem Statement
When should an API return HTTP 201 Created instead of 200 OK?
Explanation
201 indicates a new resource was created. Include a Location header pointing to the new resource.
Use 200 for a successful read or update where nothing new was created.
Code Solution
SolutionRead Only
# pseudo FastAPI
return JSONResponse(obj, status_code=201, headers={'Location': url})