Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Loveable Hypermedia APIs

Mike Kelly
December 04, 2012

Loveable Hypermedia APIs

This was a talk given at APIDays 2012 about creating hypermedia APIs that find a balance which maintains some evolvability whilst providing a good developer experience. In other words, it was a sales pitch for hal+json. ;)

Mike Kelly

December 04, 2012
Tweet

Other Decks in Technology

Transcript

  1. Your hypermedia type doesn’t need forms. But I want dynamic

    control of UI elements, forms, links, etc..
  2. “WebKit in Your Living Room” “Our teams use WebKit, JavaScript,

    HTML5, and CSS3 to build user interfaces that are delivered to millions of Netflix customers on game consoles, Blu-ray players, and Internet- connected TVs.”
  3. Intuitivity {
 _links: {
 self: { href: “/bob” },
 friend:

    [
 { href: “/ted” },
 { href: “/jen” }
 ]
 },
 date_of_birth: “1970-04-28”,
 favourite_colour: “blue”,
 age: 42,
 …
 }
  4. Intuitivity {
 _links: {
 self: { href: “/bob” },
 friend:

    [
 { href: “/ted” },
 { href: “/jen” }
 ]
 },
 date_of_birth: “1970-04-28”,
 favourite_colour: “blue”,
 age: 42,
 …
 }
  5. Intuitivity {
 _links: {
 self: { href: “/bob” },
 friend:

    [
 { href: “/ted” },
 { href: “/jen” }
 ]
 },
 …
 } {
 _links: [
 { rel: “self”, href: “/bob” },
 { rel: “friend”, href: “/ted” },
 { rel: “friend”, href: “/jen” }
 ],
 …
 }
  6. Intuitivity {
 _links: {
 self: { href: “/bob” },
 friend:

    [
 { href: “/ted” },
 { href: “/jen” }
 ]
 },
 …
 } {
 _links: [
 { rel: “self”, href: “/bob” },
 { rel: “friend”, href: “/ted” },
 { rel: “friend”, href: “/jen” }
 ],
 …
 } _links.friend[0] links.filter(function(link) {
 return link.rel === ”friend”
 })[0]
  7. Versioning (breaking change) Breaking change => new link relation ¤ Granular

    (no major version changes) ¤ Parallel versions ¤ Deprecation
  8. Parallel versioning _links: {
 …
 “v1:widget”: { “href”: “…” },


    “v2:widget”: { “href”: “…” },
 …
 }
  9. Why use HAL? ¤  ~16 libraries client & server (+more

    in future) ¤  API Browser (on github) ¤  Battle-tested ¤  bunch of companies using it ¤  ~100 threads & ~200 members on hal-discuss ¤  Extend it J