I've been interested in RESTful architectures since around 2005 but I've yet to find any really good examples in the wild of using hypermedia for RESTful APIs.If I understand correctly the value of hypermedia is to enable a robust architecture that is resilient to changes in URLs, correct? But how is it best done? For example, how should links be returned? As headers? In the content response?How should hyperlinks be identified; as name/value pairs? Are there any standard for naming, are there any standard data structures that can identify the list of links?And how are expected variables identified, and how are their values specified?Are there any attempts to standardize these for horizontal use-cases? How about within specific use-cases, as might have been done here?:
One benefit for standardization is to enable better tools to emerge, but it seems every implementation is a custom for the specific user's use-case? Or have I missed tools that are emerging? If not, are there at least some best practices documents that have emerged to be seminal?
Thanks in advance for your thoughts.
-Mike
I'd recommend taking a look at the Hypermedia approach of ElasticPath - http://www.elasticpath.com/
But the 2 demos I've had, their HATEOS implementation was well thought out...and they were able to communicate it really well.
-MikeThanks Kin. Yes, the ElasticPath implementation does appear to be well-thought out; too bad they bury their docs behind a login wall and then make it very difficult once logged in to find docs that show an example.But I'm surprised; I feared my question might erupt a heated debate yet you were the only one who answered. Are there really no other good, public and more well-known examples of HATEOAS in the wild?Last week one of my colleagues and I worked on the architecture for a RESTful client class for our use-case (WordPress integration plugins for our SaaS vendor clients.) We studied the ElasticPath implementation and tried to architect a client that would interact with SaaS APIs as if they used HATEOAS. We discussed abstracting the URL construction required by most public REST-like APIs. We thought that would allow our client to support HATEOAS when and if we came across client APIs that used HATEOAS.However, we eventually realized that processing APIs using HATEOAS adds a level of abstraction and thus so much complexity that we gave up on that approach. We decided to just do URL construction which is all that most (almost all?) public REST-like APIs prescribe. If there were a standard method for HATEOAS by content type blessed by a recommended RFC, i.e. something like the ElasticPath approach that using "self" and "links" in JSON, then maybe it would be worth implementing HATEOAS into our client. But as is, there seems that there would be no identifiable ROI for an investment in development of HATEOAS for our client for our use-cases.And that's a shame considering how many people I've seen publicly state that HATEOAS is critical for a proper RESTful architecture. But until there's a standard way to do it via HTTP, I don't see how this is going to change? If HATEOAS is so crucial, why has there been so few publicly posted examples? Why have there not been many (any?) open source implementations? Why are so few companies and /or developers embracing HATEOAS in the wild?OTOH, if my analysis is off-base, please do help me to see it differently. I would very much like that.
I think e-commerce is a universal enough concept, that I can use them to tell the story of why HATEOAS is important.
I believe it has huge potential, but the story has to be told right. I think ElasticPath + e-commerce is perfect, because of the known flows product to cart to checkout, etc. And the common business logic....but it has to be really shown to make devs life easier, meet the biz requirements of API owner, and provide ROI....otherwise it will leave bad taste in the mouth.
There are two levels of standardization that could take place; generic HATEOAS JSON formats so that generic frameworks could be built, and then an eCommerce standard built on top of a generic formats standard. If the latter was attempted to be standardized before the former, it could result in incompatible approaches across business use-cases, which would probably be worse instead of better.
I can't 100% say why HATEOAS is so considered as being so crucial, yet so few examples to showcase. I think it similar to what you said, the overhead in both implementing and explaining to your devs just doesn't make sense? IDK. I'd like to understand more.
I understand why it's important; i.e. using HATEOAS makes a system more resilient to URL change, I'm just not sure the benefit it really all that dramatic considering HATEOAS just punts the ball downstream (to mix metaphors.) Sure the URLs are no longer a breaking point but then the meta data format in the response becomes an issue. And I'm not sure if that's actually better. At least that's what I'm currently seeing.
I'll have more stories on ProgrammableWeb and API Evangelist on this as I wrap my mind around more.
-MikeSubscribed. Looking forward to them.
I've yet to hear anyone make that distinction. That's hugely helpful; thanks.As an aside regarding ATOM, it's a rather application-specific media-type, and rather complex to implement, no? I remember when it was being developed; there were untold man-hours invested in getting it to its current state. Maybe that's why there are so few other public examples, because of the effort required for definition?
I know nothing about the development process of ATOM. But I would assume it took so long time because it had to encompass many different scenarios and had a lot of different interested parties. That makes for lots of discussions.
But a more vendor specific media-type would not have those issues - it shouldn't take longer to define your application in terms of a media-type than it would take to define in terms of URLs.
It would be helpful if there were a lower level generic foundation for HATEOAS so that each vendor specific implementation would not have to reinvent the wheel. That would enable significantly more reuse than vendor-specific implementations that are developed from the ground-up, and didn't you say that major benefit of HATEOAS?I guess what I'm saying is I believe it's incumbent upon those who advocate HATEOAS as being critical to recognize the need for a shared standard for processing HATEOAS and then to develop such a standard so that each and every implementor does not have to reinvent the wheel.
It would be helpful if there were a lower level generic foundation for HATEOAS so that each vendor specific implementation would not have to reinvent the wheel. That would enable significantly more reuse than vendor-specific implementations that are developed from the ground-up, and didn't you say that major benefit of HATEOAS?I guess what I'm saying is I believe it's incumbent upon those who advocate HATEOAS as being critical to recognize the need for a shared standard for processing HATEOAS and then to develop such a standard so that each and every implementor does not have to reinvent the wheel.