Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP REST inconsistency: create should return HTTP 201 #360

Closed
fabien opened this issue Jul 2, 2014 · 10 comments
Closed

HTTP REST inconsistency: create should return HTTP 201 #360

fabien opened this issue Jul 2, 2014 · 10 comments

Comments

@fabien
Copy link
Contributor

fabien commented Jul 2, 2014

Apparently, POST /api/things returns HTTP 200 - however, 201 is the right code.

@raymondfeng raymondfeng added this to the 2.0.0 milestone Jul 7, 2014
@raymondfeng
Copy link
Member

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
Copy link
Contributor

gcirne commented 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
Copy link
Contributor

up!

@zbitname
Copy link

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
Copy link

+1

@bajtos bajtos mentioned this issue Sep 30, 2014
47 tasks
@bajtos bajtos modified the milestone: #Rel lb 2.0.0 Sep 30, 2014
@bajtos bajtos added this to the LoopBack 3.0 milestone Nov 26, 2014
@wrensburg
Copy link

Any update on this issue? Almost a year now for something I would deem critical to REST patterns and service integrators.

@seriousben
Copy link
Contributor

👍

@slyadams
Copy link

Having switched to loopback for my webservice layer I'm having to change all my tests and checks because of this inconsistency.

@bajtos bajtos added the 3.0 label May 24, 2016
@bajtos bajtos removed this from the #Epic: LoopBack 3.0 milestone May 24, 2016
@cgole cgole removed 3.0 labels Jan 7, 2017
@brawaga
Copy link

brawaga commented 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
Copy link
Member

bajtos commented 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

@bajtos bajtos closed this as completed Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests