

Please stop RESTfully abusing HTTP - anotherevan
http://ponderousprog.blogspot.fr/2014/05/please-stop-restfully-abusing-http.html

======
mcv
The title makes it sound like there's something wrong with using HTTP for
REST, but the problem described in the article is that some people don't fully
use HTTP for REST.

It's totally possible to use status codes properly, but I do see a lot of
projects where status codes aren't used (not just for AJAX, but even for
regular pages; instead they redirect to the homepage on a 404, for example).
The problem here is not using HTTP properly. HTTP suits this purpose
perfectly, so ignoring HTTP is a bad idea.

------
voidr
> This relegates HTTP to nothing more than a transport protocol.

Well maybe because it is a transport protocol, it stands for: Hypertext
Transfer Protocol

HTTP is a way to send a message from point A to point B.

If your API is tied to HTTP, then you'll have a hard time reusing the same
code for another transport protocol, like websockets.

Sometimes it makes a lot of sense to use HTTP headers codes for error
handling, sometimes it just doesn't work, you can't shoehorn HTTP/REST into
everything and expect something good to come out of it.

------
rahulrav
There is one good reason to do it. To support JSONP (json with padding). If
you use JSONP and the server sends an HTTP response code which is not 2XX,
then the browser does not allow JavaScript to parse the response body at all.

There is a way to work around this, which is to use CORS. However, that is not
supported in all browsers. So pick your poison.

~~~
mcv
CORS is not a workaround; it's the right way to do it. JSONP is an ugly hack
that should be avoided.

