There are other arguments but I think this is enough for you guys to get the gist of it. I'm at a loss here, has anybody here encountered this resistance of "lack of belief" in the concepts and reasoning behind hypermedia? What unnassailable arguments (assuming they exist), real concrete proof, of the advantages of hypermedia? Stuff that just wouldn't be possible without hypermedia (rememer we are talking about automated machines/code consuming APIs, without intervening humans to direct actions and provide input).
Myself, I'm all for it, I understand and see the value in the concept, however I'd like to know if there are people out there that have gone through this process, what they did to improve the situation.
Cheers,
Pedro
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft.
For more options, visit https://groups.google.com/groups/opt_out.
--
By starting one service at a time, roll-out was much easier and with a lot less friction. Also, by standardizing some of the decisions (e.g. which media type(s) to use, how to name relations, what tools to use, how to handle errors), we also made the implementation process less intimidating as a whole.
First, writing stateless severs for hypermedia is easy and we have lots of tooling to do it. writing stateless *clients* is not so easy and we have virtually NO tools for doing it. Second, writing machines that can make choices relies on messages that enablel them. there are few media types that are designed for machines; most all are designed for humans. Finally, the skill of writing client-server interactions for machines is not one commonly taught and most of the valuable lessons lies in usability studies (again mostly applied to humans ATM).
URI structure is orthagonal to app domain. I can implement a service w/ guids for URLs and the server would work just fine. usually this talk comes from thinking that the URI describes the domain instead of the message body. it's a weak argument. URIs will change over time, your tools will lead you to use them inj odd ways in order to get routing and/or arg processing right for complex cases. focus on the action (adding) not the address (URI) and you'll be fine.
--
You received this message because you are subscribed to a topic in the Google Groups "API Craft" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/api-craft/ZxnLD6q6w7w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to api-craft+...@googlegroups.com.
Somewhat science-project, but I am very interested in the relationship between hypermedia and http/2.
For example, one very common complaint of link processing is N+1 requests. Ignoring collection apis which have inlining, http/2 does allow you to deal with links efficiently.
For example, your api server can send multiple responses including those commonly requested links. This has a similar effect as inlining except less opinionated as which are pushed down can be controlled independently. The same http resource would work with http 1.1, just that the client would need to pull these links (n+1) until such time as they update to http/2 or spdy.
Moreover, http/2 can be very efficient even when multiple requests are needed. Not only can you multiplex requests on the same tcp connection, but also much of the headers don't need to round trip (due to HPACK).
So far, I believe the case for hypermedia style is dramatically improved when considering a future of api servers that speak spdy or http/2.
2p
-A
1) After a year or so, you figure out that, duh, "Users" is the wrong domain concept - it should be "Persons". If you reflect your domain model 1:1 on the network/REST level then all clients has to be reprogrammed to use /persons instead of /users as their URL. If your clients used hypermedia and were ignorant of the actual URL structure, you would have no problems - all you had to do was to change the server-generated URLs in the returned hypermedia representations - and you clients would be following that instead.
3) At some time you realize that some of the resources must be moved to a CDN (Content Delivery Network) - or hosted by another company for other reasons. Now your clients have NO way to be preprogrammed with the URL structures as some of your resources will be moving around on different servers - and you may even want to be able to use different CDN vendors over time. Now you MUST use links in your resource representations - links that will guide the client to where the "stuff" is.
A couple of these points have come up a few times so I wrote a short
blog post about them
the work of designing URLs doesn't _improve_ the RESTful-ness of an implementation and it doesn't _reduce_ it, either
that's great to hear. would love to get some details on the experience of starting this up, getting it working, dealing with the change internally (archs, devs, deployment, etc.).
On 28 Nov 2013 01:30, "Dave Bettin" <m...@davebettin.com> wrote:
>
> We just released a beta of our API [1] which is inspired by JSON-API and HAL. We most likely will align with JSON-API once it's finalized (hopefully, sooner rather than later!)
>
Hi Dave, do you mind if I ask why?
Cheers,
M
The server implements this by storing a unique identifier in the POE resource URL and keeps track of its use.
You can obtain the same result by asking the client to create a GUID and include that in the POST request. But by using HTTP status codes, links and redirects as above we remove that kind of business logic from the client and stick to well known HTTP mechanisms instead.
So what I am trying to say? I just want to illustrate some of the things you can do with links, and how it can remove knowledge of URL structures from the client. Its not a general argument in favor of hypermedia - just a practical example.
/Jørn
Good write up. Selling point: gives us a way to preserve and extend the effects of Conway's law. ;-]
You received this message because you are subscribed to a topic in the Google Groups "API Craft" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/api-craft/ZxnLD6q6w7w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to api-craft+...@googlegroups.com.
On 28 Nov 2013 15:13, "Jørn Wildt" <j...@fjeldgruppen.dk> wrote:
>
> The most well known and often cited reason: using hypermedia allows the server to change URL structure without changing any clients.
> - This adds a layer of decoupling between the client and the server URL structure. But, hey, why should the server change its URL structure anyway?
>
Because the server was given an initial URI structure that became unsuitable over time (e.g. nested resources needing to be un-nested or vice versa). Or, say, some part of an API needs to be extracted into a distinct service running on a different server for performance reasons.
>
> Versioning can be handled by adding new links. This really isn't such a good argument since new resources can be added in a traditional Web API too without breaking clients.
>
The argument stands. It is far easier to convey options to clients and manage granular changes in parallel by adding new links than it is by juggling URI prefixes, media types, or HTTP headers.
> The thing is, hypermedia isn't such a breakthrough with single server services - that as, services like Twitter etc. that only exists in one single implementation. Its a nice add-on and it does have some benefits as we have argued so far, but nothing really revolutionary.
>
Well that depends a lot on the scale of your problem and the value at stake.
I think the points on the list make it clear that there are tangible benefits to adopting hypermedia for "single server" APIs.
Really the focus ought to be; is adopting hypermedia too costly?
I think it depends largely on the design of the format you adopt or create. I think provided the messages of your API stick to affording the key points raised here, and are designed to create as little friction as possible for clients.. Then its easy to make the case that it is not too costly. Adding more than the essentials, though, is definitely a cost.
Fwiw, this is exactly why I erred towards minimalism in the design of hal+json. But I think some just see it as a lack of ambition or imagination. You can't please everyone, I guess! :)
Cheers,
M
From: api-...@googlegroups.com [mailto:api-...@googlegroups.com] On Behalf Of Mike Kelly
Sent: Thursday, November 28, 2013 4:35 PM
To: api-...@googlegroups.com
Subject: Re: [api-craft] Selling the benefits of hypermedia
On 28 Nov 2013 15:13, "Jørn Wildt" <j...@fjeldgruppen.dk> wrote:
>
> The most well known and often cited reason: using hypermedia allows the server to change URL structure without changing any clients.
> - This adds a layer of decoupling between the client and the server URL structure. But, hey, why should the server change its URL structure anyway?
>
Because the server was given an initial URI structure that became unsuitable over time (e.g. nested resources needing to be un-nested or vice versa). Or, say, some part of an API needs to be extracted into a distinct service running on a different server for performance reasons.
[JoshCo] Another benefit to this (related to a point below) is for APIs that are designed to be standardized across multiple implementations from multiple vendors who may use different technologies to implement. The URL conventions will vary by framework, vendor server architecture and developer preference. Having this abstraction allows one to write a single client that can speak to heterogeneous implementations.
>
> Versioning can be handled by adding new links. This really isn't such a good argument since new resources can be added in a traditional Web API too without breaking clients.
>
The argument stands. It is far easier to convey options to clients and manage granular changes in parallel by adding new links than it is by juggling URI prefixes, media types, or HTTP headers.
> The thing is, hypermedia isn't such a breakthrough with single server services - that as, services like Twitter etc. that only exists in one single implementation. Its a nice add-on and it does have some benefits as we have argued so far, but nothing really revolutionary.
>
Well that depends a lot on the scale of your problem and the value at stake.
I think the points on the list make it clear that there are tangible benefits to adopting hypermedia for "single server" APIs.
Really the focus ought to be; is adopting hypermedia too costly?
I think it depends largely on the design of the format you adopt or create. I think provided the messages of your API stick to affording the key points raised here, and are designed to create as little friction as possible for clients.. Then its easy to make the case that it is not too costly. Adding more than the essentials, though, is definitely a cost.
Fwiw, this is exactly why I erred towards minimalism in the design of hal+json. But I think some just see it as a lack of ambition or imagination. You can't please everyone, I guess! :)
Cheers,
M
--
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft.
For more options, visit https://groups.google.com/groups/opt_out.
@mca - Lazy morning. Went to buy the kindle version of your book. Seems to be unavailable though I see reviews of it.
cool. i figured we were thinking along the same lines.SOTA (state of the art) is mixed from my POV. I took a shot at this message-based approach in my 2011 "Building Hypermedia APIs..." book. Leonard Richardson's "RESTful Web APIs" (I co-authored w/ him) is a very good book that focuses on hypermedia, too.I like single-message formats (like Collection+JSON and Siren) that handle all responses including error information. I designed Cj to be _hard_ to use as a target for serializers because that's a design pattern i don't like (aesthetically) on the Web. But Atom and esp. HAL (which was just picked up by Amazon for a new API implementation) are both very friendly to serializers and have a much bigger mind-share than Cj or Siren (even though HAL is only a few months "older" than Cj). NPR uses a variant of Cj that makes some metadata easier to express. I think they use JSON Home Document, too.Steve Klabnick (and others) are working on JSON+API which has a "variant" that supports links. Not seen much of that in the wild yet, but it's less than a year old, i think.Anyone else have other newly-minted hypermedia-style formats I didn't mention here?
On Wed, Nov 27, 2013 at 6:05 PM, Kijana Woodard <kijana....@gmail.com> wrote:
Nice. I should have used the word "messages" instead of "action modeling" since that's precisely what I'm thinking.What's the "state of the art" in this area?My, quite naive, thoughts have been to "POST messages" and then figure out things like "location headers for progress/results", errors (http://tools.ietf.org/html/draft-nottingham-http-problem-04), etc.
On Wed, Nov 27, 2013 at 4:11 PM, mca <m...@amundsen.com> wrote:
*** sorry, bit of a rant, but here goes ***yes, URIs alone are not enough affordance for all the things needed to change server state. this is why the link-style controls (HTML.A) are OK for read-only, but lacking for write operations. for that we need a template-style control (e.g. HTML.FORM) that includes not just transition basics like URL, method, and content-type, but also info on what state data to pass in (e.g. HTML.INPUT). while HTML is a very much under-powered message design, it has worked incredibly well for human-driven dist apps _because_ it includes both link- and template-style affordances.HAL, Cj, and Siren are all attempts at making things better for the non-human cases (or the cases where the interface is not responsible for UI elements, just responsible for transition and response representations).as for the "noun" problem, I think a key challenge for interface designers and implementers is to stop trying to map OO-style nouns and behavior onto the loosely-coupled WWW. We need to get back to using messages (not functions and objects) as the primary way to communicate on the Web. There the message and the actions it describes are the key. This is similar to the "action modeling" you mention.The slippery slope right now is to use Link Relation Values as function names or object names and that leads us back to the same frustrations and limitations we've experienced for the last several years. IMO, we need better tooling. the kind that leads arch and devs down the "happy path" of message-based "action over address" modeling and implementation. We don't have that yet.So anyone doing HAL, Cj, Siren, etc. has to "swim against the current" and use tools in novel ways, ignore the current "happy path to OO" and create their own libraries and tooling. This is added time and added cost and is often calculated in as the inherent "Cost of Hypermedia/REST." And that's a bummer. We paid huge costs to get the tooling for SOAP and now no-one counts that cost when starting a new SOAP-based project. We need to get to the same place for Hypermedia-style projects. Where the cost was paid by tooling vendors up front and arch/devs get to reap the beneifts.
On Wed, Nov 27, 2013 at 4:30 PM, Kijana Woodard <kijana....@gmail.com> wrote:
One thing that continues to bother me about the discussion about ReST is the direct projection of nouns from the domain onto the url space. From using APIs (not hypermedia to this point), what I find is that there is a pile of nouns presented. The client api is then left to construct meaningful actions out of this. This often leads to situations where the server state is unknown, unknowable, and the client app has no way to make meaningful decisions."If I'm modeling a domain with "users", "accounts", "cars", "addresses", whatever"So now my app wants to "make an appointment to test drive a 2014 Tesla Blah Blah at the Main street dealership at 9 am next Tuesday". Too many apps leave us to GET/POST/PUT the nouns instead of modeling actions directly in the api space.I've seen hal/hypermedia examples that show such "action modelling", and it is a relief.The API space doesn't have to / probably shouldn't map 1:1:1 with domain aggregates and database records.
On Tue, Nov 26, 2013 at 5:51 PM, Pedro Santos <pnuno....@gmail.com> wrote:
Hi guys,
For the last couple of weeks I've been involved in a workgroup inside my company for setting down some general guidelines and recomendations for building REST APIs for the various teams and projects. Up until recently everything was more or less uneventfull, people inside the workgroup agree fairly well on areas such as proper use of HTTP methods, understanding of resources vs representations, that you should use HTTP error code appropriately, etc. Basically everyhing up until Level 2 of the RMM (Richardson Maturity Model).
However I've been trying now for a few meetings to "sell" the idea of hypermedia, that although it doesn't solve every semantic problem, it's a step in the right direction. But I've hit a seemingly unsurpassable wall... most of the arguments "against" hypermedia seem to stem for the fact that, when talking about machines as clients (and not users) there isn't enough "inteligence" to make decisions based on links, that a machine client is always "hardcoded" to a certain API behaviour and therefore links as a formal construct of an API representation is useless. Some of the stuff I've heard is:
- REST should be simple, and hypermedia only complicates stuff. That it's much more complicated or complex to write clients to parse and consume links than to read an "id" and add it to an pre-known URI
- That the paralell frequently established between the success of the web and hypermedia, doesn't apply to machine API clients since they lack the inteligence that allows people to "navigate" the web and make use of the application controls embedded in representations
- That there are many hypermedia formats without one or two having a prevailing presence (which means immaturity and not ready for "prime-time" > use an approach of wait and see)
- Since (in the POV of the no-hypermedia proponents) clients need to have implicit knowledge of the application domain, and since that application domain is to be expressed in terms of resources and relations between resources that it stands to reason that the clients should have implicit knowledge of an API's URI structure
- That hypermedia adds "bloat" to a JSON or XML message, which otherwise would be much smaller (say listing an array of IDs insteand of an array of links)
- Hypermedia is one of those subject that is of interest to academia, but will never be "used for real"
There are other arguments but I think this is enough for you guys to get the gist of it. I'm at a loss here, has anybody here encountered this resistance of "lack of belief" in the concepts and reasoning behind hypermedia? What unnassailable arguments (assuming they exist), real concrete proof, of the advantages of hypermedia? Stuff that just wouldn't be possible without hypermedia (rememer we are talking about automated machines/code consuming APIs, without intervening humans to direct actions and provide input).
Myself, I'm all for it, I understand and see the value in the concept, however I'd like to know if there are people out there that have gone through this process, what they did to improve the situation.
Cheers,
Pedro
--
You received this message because you are subscribed to the Google Groups "API Craft" group.To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to a topic in the Google Groups "API Craft" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/api-craft/ZxnLD6q6w7w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "API Craft" group.
To unsubscribe from this group and stop receiving emails from it, send an email to api-craft+...@googlegroups.com.
Visit this group at http://groups.google.com/group/api-craft.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to a topic in the Google Groups "API Craft" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/api-craft/ZxnLD6q6w7w/unsubscribe.
To unsubscribe from this group and all its topics, send an email to api-craft+...@googlegroups.com.
Thanks! Purchased.
as for the "noun" problem, I think a key challenge for interface designers and implementers is to stop trying to map OO-style nouns and behavior onto the loosely-coupled WWW. We need to get back to using messages (not functions and objects) as the primary way to communicate on the Web. There the message and the actions it describes are the key. This is similar to the "action modeling" you mention.
The slippery slope right now is to use Link Relation Values as function names or object names and that leads us back to the same frustrations and limitations we've experienced for the last several years.