You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HTTP REST inconsistency: create should return HTTP 201 #360
I agree that POST for creation should return HTTP 201. In addition, there should be a 'Location' header with a URL points to the instance being created, for example:
Should be so:
POST /api/things returns HTTP 201
PUT /api/things/:id returns HTTP 200
GET /api/things/:id returns HTTP 200
GET /api/things returns HTTP 200 or 206 if need "Range"
DELETE /api/things/:id returns HTTP 204
@zbitname, PUT also might and should return 201 if the request led to instance creation. 200 for rewriting existing one only. DELETE may return 200 in case you decide to design your API in way DELETE to return deleted item in response.
LoopBack 3 is in Maintenance LTS mode, only critical bugs and critical security fixes will be provided. We are tracking this request for LoopBack 4 here: loopbackio/loopback-next#788
Activity
raymondfeng commentedon Jul 7, 2014
I agree that POST for creation should return HTTP 201. In addition, there should be a 'Location' header with a URL points to the instance being created, for example:
Location: http://localhost:3000/api/things/1
Since it will be a breaking change, we'll probably have to fix it in 2.x stream.
gcirne commentedon Aug 4, 2014
Hey guys,
Any news on this issue?
I could probably provide a PR for it but I would need some pointers on where the changes should be made.
albertoleal commentedon Aug 14, 2014
up!
zbitname commentedon Aug 14, 2014
Should be so:
POST /api/things returns HTTP 201
PUT /api/things/:id returns HTTP 200
GET /api/things/:id returns HTTP 200
GET /api/things returns HTTP 200 or 206 if need "Range"
DELETE /api/things/:id returns HTTP 204
wpjunior commentedon Aug 14, 2014
+1
wrensburg commentedon May 7, 2015
Any update on this issue? Almost a year now for something I would deem critical to REST patterns and service integrators.
seriousben commentedon May 7, 2015
👍
slyadams commentedon Feb 24, 2016
Having switched to loopback for my webservice layer I'm having to change all my tests and checks because of this inconsistency.
brawaga commentedon May 15, 2017
@zbitname, PUT also might and should return 201 if the request led to instance creation. 200 for rewriting existing one only. DELETE may return 200 in case you decide to design your API in way DELETE to return deleted item in response.
bajtos commentedon Mar 10, 2020
LoopBack 3 is in Maintenance LTS mode, only critical bugs and critical security fixes will be provided. We are tracking this request for LoopBack 4 here: loopbackio/loopback-next#788