3 ms·
That's sort of the point, it was to remove the meat requirement on discovering those. Making the edit/delete/whatever forms and requirements machine readable s
by munk-a 8y ago
That's sort of the point, it was to remove the meat requirement on discovering those. Making the edit/delete/whatever forms and requirements machine readable so a stronger but still generic client tool can interpret them more intelligently.
Again, I think it's naive since while a lot of stuff has plain CRUD operations, there are entities in most webapps that have more complex operations. If I were writing an application that partially managed cutlery in a restaurant it's not clear where a "clean" verb on a fork would fit into REST and how a generic client would understand what significance "clean" has especially as it relates to future eat actions.
I have read through and understand the intent of the original RESTful system and I think there are some good and bad points. But, automatic discovery was definitely included in their vision of how it'd work, and actually seems like the center point TBH.
- philwelch 8y ago> That's sort of the point, it was to remove the meat requirement on discovering those. Making the edit/delete/whatever forms and requirements machine readable so a stronger but still generic client tool can interpret them more intelligently. Hmm, that makes REST sound like it's pursuing similar ideas as the Semantic Web. > Again, I think it's naive since while a lot of stuff has plain CRUD operations, there are entities in most webapps that have more complex operations. If I were writing an application that partially managed cutlery in a restaurant it's not clear where a "clean" verb on a fork would fit into REST and how a generic client would understand what significance "clean" has especially as it relates to future eat actions. It isn't clear at all. It's possible, but in weird, hacky ways. Maybe when you're done with a fork, you DELETE the fork and then you can POST to /clean_forks/ to create a newly cleaned fork. And if you run out of forks to clean, it throws a 503 error. It's a terrible Kingdom of Nouns (https://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html https://steve-yegge.blogspot.com/2006/03/execution-in-kingdo...) but it might appeal to some people, for the same reasons that the original Kingdom of Nouns appealed to some people. After all, you get to feel clever and smart when you invent new design patterns to work around the limitations of your technology. Just writing a `clean_fork` RPC doesn't make you feel clever at all. In any case, while I can see automatic discovery as a useful feature for web browsers (who can still punt the actual decision-making to the meat, as long as they know what the plausible next steps would be), it doesn't seem likely to me that service clients would benefit from it any more than they benefit from a thoughtfully designed and documented RPC API. Meanwhile, for whatever reason, the end-user-facing web has decided to prioritize the use case of, "you will see and interact this web page according to The Original Creative Intention Of The Author" over the use case of, "here, have some data, it links together, do whatever the hell you want with it, I don't care what fonts or UI widgets you use". REST would have been great for the second use case; it's just that nobody cares about it anymore.
- geezerjay 8y ago> Hmm, that makes REST sound like it's pursuing similar ideas as the Semantic Web. One of the founding principles of REST is that links should be discoverable and resources should include the semantics of each link that's directly accessible from them. https://en.wikipedia.org/wiki/HATEOAS https://en.wikipedia.org/wiki/HATEOAS
- droussel 8y agoYour "fork" resource simply need to include a hyperlink to the cleaned self. Its no different then obtaining a "clean" page on the web, with the forms emptied, etc... <fork> <a rel="clean_fork" href="http://example.com/very_clean_fork" http://example.com/very_clean_fork" /> </fork>
- munk-a 8y agoIndeed, and what does `clean_fork` mean? I don't disagree that it has some value, defining associated actions for the resources being served, I was more questioning how universal this approach could ever be. And bear in mind `<a rel="clean" href="http://example.com/database/clean">` http://example.com/database/clean">` would have a very different semantic meaning from `<a rel="clean href="http://example.com/fork/clean">` http://example.com/fork/clean">` or what have you. I agree that semantic actions are a thing it'd be nice to solve and I wanted to make sure this discussion on REST touched on the fact that semantic actions are something they tried to solve. But they didn't, we've assigned common meaning to common verbs (which is pretty sweet on its own) but everything else isn't discoverable. If you were a rather dumb client interface and got a `<a rel="clean_fork">` what would you do with that inherently except say "It isn't delete or put or patch, so I don't know what this does"
- droussel 8y agoMedia-types and their semantic were always supposed to be sideband information, just as the meaning of <a> and <form> is documented in HTML. An easy way to think of it is that a Web Browser is a client for a REST architecture consisting of the web. If you create a new system and use a REST architectural style, the client app(s) will be the "browsers" for your API. When you implement a web browser, you do need to receive sideband information about the media-type (HTML) and your client application has to be able to understand those, including what <a> and <form> mean, for example. In a custom API, you use the same HTTP verbs if you want (REST doesn't mandate HTTP) but you need to define your media-types.