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

Hypermedia APIs for the Enterprise

Hypermedia APIs for the Enterprise

by Jon Moore @ Apistrat NYC (Feb. 2013)

More Decks by API Strategy & Practice Conference

Other Decks in Technology

Transcript

  1. Domain  Models   TVEpisode   TVSeason   TVSeries   part-­‐of-­‐season

      part-­‐of-­‐series   part-­‐of-­‐series   “The  Simpsons”   name  
  2. Workflow:  Client  Applica@on  State   START   Search   Results

      Cart   Item   Detail   Shipping   &   Billing   Payment   ConfirmaYon  
  3. Mechanics  for  Transi@ons   POST /api/widgets HTTP/1.1 Host: www.example.com Content-Type:

    application/json Content-Length: 13 {‘foo’:‘bar’} method   URI   formaeng  of  request  body  
  4. Evolving  Models   TVEpisode   TVSeason   TVSeries   part-­‐of-­‐season

      part-­‐of-­‐series   part-­‐of-­‐series   “The  Simpsons”   name   Video   associated-­‐media  
  5. Evolving  Workflow   START   Search   Results   Cart

      Item   Detail   Shipping   &   Billing   Payment   ConfirmaYon   update  qty   edit   Gii  Message   submit  
  6. Link  Rela@ons:  IoC  for  Workflow   author next prev first

    last edit index item search http://example.com/my-rel
  7. •  SemanYc  markup   •  RDFa:  hDp://www.w3.org/TR/xhtml-­‐rdfa-­‐primer/   •  JSON-­‐LD:

     hDp://json-­‐ld.org/   •  Hypermedia  controls   •  CollecYon+JSON:  hDp://amundsen.com/media-­‐types/collecYon/   •  HAL:  hDp://stateless.co/hal_specificaYon.html   •  Siren:  hDps://github.com/kevinswiber/siren   •  Link  relaYons   •  IANA  registry:          hDp://www.iana.org/assignments/link-­‐relaYons/link-­‐relaYons.xml   •  Link  header:  hDp://tools.ieq.org/html/rfc5988   Related  Work  
  8. •  Enterprises  ≈  collecYon  of  ADs   •  Independent  Evolvability

     is  the  key  to  scale   –  Domain  model  (“where  am  I?”)   –  Workflow  (“what  can  I  do  next?”)   –  Mechanics  (“how  do  I  do  it?”)   •  HTML5  offers  an  exisYng,  pracYcal  opYon  for   building  hypermedia  APIs   •  Efforts  underway  to  duplicate  this  for  JSON   Conclusions