(no title)
bmn_ | 10 years ago
Does not follow. People spend so much time debating what is and what isn't REST because there are a great number of people who do not understand the topic, have no actual interest in learning it properly, and then come to wrong conclusions and start making wildly inaccurate arguments.
Not all Web application problems can be cleanly modelled over REST, so indeed it is not the asnwer to everything, but most can. For those that can, using the REST architectural style is more advantageous than, let's say, remote-procedure calling.
> All the simple REST examples make it look like it is the perfect solution for CRUD tasks.
All the simple REST examples are written by those ignorants I mentioned above. The simple CRUD model falls apart when there is just a little more complication involved. REST does not mean just CRUD, as any decent REST book teaches.
> If the server returns 404 for a resource, what actually happened? Did the web server or my application return the 404.
⁇ If the server returned 404, the server returned 404. This means the client application/the user agent made a mistake, indicated by the leading digit 4.
> Conflating HTTP and application error codes leads to confusion.
When following REST, that conflating is actually a good practice. Not doing so means tunnelling a proprietary, possibly ad-hoc protocol over HTTP, resulting in non-interoperability. There is no need for any confusion, the response body can deliver a precise problem description applicable to the concrete error condition, perhaps even giving an indication how to fix the problem. There is a wealth of status codes <https://github.com/for-GET/know-your-http-well/blob/master/s... and many of them semantically map to typical application error states, and it's okay to fall back to generic codes like 422 or 400.
> HATEOAS is just superfluous. […] I just haven't found a practical use for it.
You need to bring a better argument to the table. Establishing relations between and traversing resources using links and other hypermedia controls is central to the REST architectural style. Every Web browser does this, for timbl's sake!
> REST encourages creating a CRUD interface for every single resource.
Not true. Nothing in REST encourages this. It's the software architect's fault if there are 100 (supposedly underutilised) resources, not the fault of the architectural style.
kisstheblade|10 years ago
Or the endpoint wasn't configured properly even though the client had the right address. Happens often when developing, maybe another developer changed the endpoint url? Or in production some endpoint hasn't started. (yes this problem is seldom a problem in production or you usually know from other things that the problem is at the server, annoying still)
I've had problems with not knowing if 404 is "person not found" type error or "endpoint address is plain wrong"
"Bad Request" doesn't describe the situation either very well, I've used it myself to eg. signal missing mandatory parameters.
But just using eg. the code 200 as someone suggested and returning your own status message seems a little bit overkill.