[Catalyst] RESTful response codes.

Dave Rolsky autarch at urth.org
Fri Feb 24 03:08:07 GMT 2012


On Fri, 24 Feb 2012, Bill Moseley wrote:

> This consumer of he API is arguing that the 2xx HTTP response are not =

> enough of a "status" -- that every request needs a status (and that =

> should not mix HTTP "transport" codes with business logic). =A0But, I =

> cannot think of an example where this would be the case.
> =

> So you do GET /user/1234 and it returns a 200 with a status saying { =

> status =3D> "here's the user you asked for, but I was not able to look up =

> their LDAP id because the server was down. =A0Hope you don't mind the =

> omission." }. =A0That's a scary road to head down, no?
> =

> I cannot think of a POST, GET, PUT, or DELETE on a resource where the =

> status cannot be represented with HTTP response status -- because that's =

> how it is designed.

I think part of this comes down to your choice of URI and what represents =

a "thing" in your web app.

If you're able to separate each thing into a sane URI and support PGPD as =

appropriate on every URI, then the HTTP statuses should "just work", for =

some value of "just".

One thing that can be a bit though is some sort of batch update, where you =

want to update more than one thing at once for efficiency. What do you do =

if part of the batch succeeds and part fails? Maybe you just run =

everything in a transaction so this isn't possible.


-dave

/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
http://VegGuide.org               http://blog.urth.org
Your guide to all that's veg      House Absolute(ly Pointless)
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/


More information about the Catalyst mailing list