4 ms·
In my opinion, you can't really understand REST until you understand HATEOAS - the two concepts work together and REST (and the restrictions it imposes) isn't r
by teddyh 10y ago
In my opinion, you can't really understand REST until you understand HATEOAS - the two concepts work together and REST (and the restrictions it imposes) isn't really very meaningful without HATEOAS.
Twilio Conference 2011: Steve Klabnik, Everything You Know About REST Is Wrong: http://vimeo.com/30764565 http://vimeo.com/30764565
REST APIs must be hypertext-driven: http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hyperte...
Hypermedia APIs - Jon Moore: http://vimeo.com/20781278 http://vimeo.com/20781278
Designing a RESTful Web API: http://blog.luisrei.com/articles/rest.html http://blog.luisrei.com/articles/rest.html
- jpulec 10y agoCame here looking for a comment like this. If you're not discussing HATEOAS at all, you will be losing out on many of the benefits that REST provides.
- dfsegoat 10y agoIt's the 'central dogma' of RESTful services.
- edwinyzh 10y agoThe first time I heard about HATEOAS is from the authoer of intercooler.js, and these tow of his blog posts were insiprable: HATEOAS is for Humans :(http://intercoolerjs.org/2016/01/18/rescuing-rest.html http://intercoolerjs.org/2016/01/18/rescuing-rest.html) Rescuing REST From the API Winter: (http://intercoolerjs.org/2016/05/08/hatoeas-is-for-humans.html http://intercoolerjs.org/2016/05/08/hatoeas-is-for-humans.ht...)
- vinceguidry 10y agoFrom your second link: > A REST API must not define fixed resource names or hierarchies (an obvious coupling of client and server). Servers must have the freedom to control their own namespace. I'm not getting it. We have an API layer serving both mobile and web clients. When we change the API layer, we have to be careful to not remove any fields willy-nilly that mobile might be using. Instead we hard-deprecate mobile versions and remove fields later. It keeps the application stable but makes future architecture depend on past architecture. Server instruction on URL construction seems to be doing a lot of work in order to not fix the problem. It does not buy us the ability to just switch around field names and relations and hierarchy without concerns for what consumers were using the old system. That's the real problem with server / client coupling, not that the client needs to magically know which route a created resource has. Sticking a link in the response body just seems silly. Without reinventing SOAP in JSON form, by this I mean providing machine-readable schema information via the API, I can't see a way through this. But even that wouldn't solve the problem, you'd need some kind of intelligence on the client side for managing an API that might shift around under it without warning. If we change a field from createdDate to createDate, is there a way to use HATEOAS to communicate the name change?
- masklinn 10y ago> I'm not getting it. It's just saying that the "URLs" are not fixed in the client (aside from the one root URL) and are provided by the server and dereferenced from content types. > If we change a field from createdDate to createDate, is there a way to use HATEOAS to communicate the name change? No. In REST/HATEOAS, the content types are fixed and documented, the hierarchy is mobile. Content type alterations impact clients which may not be generic over type contents.
- vinceguidry 10y agoOK, I understand better now, thanks. What does a mobile hierarchy buy me? Edit: nevermind, I think I can see the idea. Thanks!
- stymaar 10y agoI might be unlucky but I've personaly never encountered a single REST API that implements HATEOAS (among many third party APIs I've integrated into softwares I've been working on on). If almost nobody who implements a REST API has HATEOAS in mind, doesn't it mean that REST is de facto independent from HATEOAS, no matter what the initial theoretician said about what REST should contain ? In other words, if REST mean something different for almost everybody than REST for the author (and a minority of people aware of the author's first intention), then in my opinion it doesn't mean that everybody is wrong about REST, it just mean that the word «REST» has evolved to a slightly more relaxed definition. This is also the claim of this talk: https://www.youtube.com/watch?v=6UXc71O7htc https://www.youtube.com/watch?v=6UXc71O7htc
- masklinn 10y ago> If almost nobody who implements a REST API has HATEOAS in mind, doesn't it mean that REST is de facto independent from HATEOAS If it's independent of HATEOAS what is in REST? If it's just doing HTTP, why not call it HTTP?
- stymaar 10y ago> If it's independent of HATEOAS what is in REST? Using GET/POST/PUT/DELETE with a defined semantic, the confidence that GET is idempotent, and the proper use of HTTP status codes. Back in 2005, it was really common to have only GET routes even for update of deletion, or worst: to have a single url: http://example.org/action http://example.org/action which concentrated all the API surface, different behavior being triggered by the type of the payload (JSON or even XML). Also, all the errors where `200 OK` but with a payload which contained the error. It was all done on top of HTTP but nothing was really using the HTTP tools (route + method + status code). Every single API / webservice had its own logic & semantic, working with 3rth party was a nightmare … It's exactly this kind of mess that the modern trend of «non-dogmatic REST» really solved. > If it's just doing HTTP, why not call it HTTP? Is it really REST ? No. Is everybody calling it REST ? Yes. Can we change how everybody calls it ? I don't think so, and I don't really think it matters. Many things are poorly named[1], but as soon as it gets to the popular language we need to use it for what it mean for people, not for ourselves. [1] Is a «quantum leap» a nano-scale step forward ? Where is the isomorphism in an Isomorphic web app ?