5 ms·
Sure, but peterwwillis was likely making the point that REST sometimes just gets in the way. REST itself is not complicated, but trying to make it work where it
by vyrotek 13y ago
Sure, but peterwwillis was likely making the point that REST sometimes just gets in the way. REST itself is not complicated, but trying to make it work where it shouldn't can complicate what you're trying to do. Not all APIs can be modeled well with the "resource" or "document" concept. A lot of times all you really want is to ping an endpoint and get/post some data.
- icebraining 13y agoIf you just want to get/post some data, why are you modeling the system using functions (computations)? If anything, a document oriented approach is much more suited for that use case.
- vyrotek 13y agoSorry. I shouldn't have over simplified that point about it being just data. I meant to emphasize that you really want to just call an operation and "just do some work". The data being just function parameters with optional data returned. I'm currently working on a few large B2B APIs and it's been difficult to implement REST. The value of these APIs come from the actual work performed and not just updating the state of a few rows in a DB. I have very "business logic" heavy endpoints which take many parameters and return very different payloads. As much as I hate it, sometimes business and practicality comes before purity. :) I actually asked for some feedback in a comment below buried somewhere: https://news.ycombinator.com/item?id=5819821 https://news.ycombinator.com/item?id=5819821
- icebraining 13y agoOh no, I certainly don't think there's anything wrong or impure about not implementing REST. REST is an architectural style that, by imposing some constraints, gives you certain benefits (Fielding's paper talks about this). It's not a panacea, and it's certainly not right for every case. Just don't make an RPC API and call it RESTful ;)
- jlouvel 13y agoI fully agree. Fielding warns in his dissertation about design by buzzwords himself. Almost all web APIs out there aren't REST APIs because they don't respect the "driven by hypermedia" constraint which makes sense because this constraint was put in place for human users driving applications through web browsers, not for machines. I've started to formalize a new "Web API" architecture style that takes the best of REST but leaves the requirements and constraints that don't make sense. See this blog post: http://blog.restlet.com/2013/05/02/how-much-rest-should-your-web-api-get/ http://blog.restlet.com/2013/05/02/how-much-rest-should-your...
- bbq 13y agoMaybe HTTP is simply missing the INVOKE verb for executable documents.
- vyrotek 13y agoSounds good to me :)
- steveklabnik 13y agoThat's already POST, basically. Furthermore, if you really wanted to, HTTP does allow new verbs to be added, so...
- icebraining 13y agoIf you want to retrieve some data based on some parameters, you can just GET it and pass some query strings. You shouldn't need to care if the data comes from an executable file (which is usually does anyway) or someone typing it in on a terminal.