My Journey into the Terrifying World of Hypermedia

2,031 views

Published on

Presentation by Ronnie Mitra, Principal API Architect - Europe from Layer 7 API Academy at Nordic APIs in Copenhagen. 21st May - 2013

Published in: Technology
  • Be the first to comment

  • Be the first to like this

My Journey into the Terrifying World of Hypermedia

  1. 1. My Journey into the Terrifying World ofHypermediaRonnie MitraPrincipal API Architect - EuropeLayer 7 API Academy
  2. 2. API Managementvirtual cloudon-premise
  3. 3. The Hypermedia Style
  4. 4. Tunnel StyleURI StyleEvent Driven StyleHypermedia Style
  5. 5. Hypermedia Style
  6. 6. Our hero(in this story)
  7. 7. Fear
  8. 8. Will developers need to build‘smart’ clients?
  9. 9. How hard will this be and is itreally worth it?
  10. 10. Will it help my business?
  11. 11. Why isn’t everyone doing this?
  12. 12. I need to confront hypermedia head-on!
  13. 13. www.apiacademy.co
  14. 14. Start by defining interactions
  15. 15. As a mobile app I want to..• Retrieve a list of videos• Retrieve a list of blogs• Retrieve a list of featured videos• Retrieve a list of featured blogs• Submit user generated comments• Retrieve comments• Search for blogs based on criteria
  16. 16. A shot in the dark:Defining a Media Type
  17. 17. Links to things that a client can doResponse entitiesMeta information for processing
  18. 18. {"links" : [{"task": "retrieve latest blogs","href“:"…","rel“:"?"},{"task": "find blogs","href“:"…","rel“:"?"}]}GET /content
  19. 19. {"links" : [{"task": "retrieve latest blogs","href":"…","rel" : "get-blogs"},{"task": "find blogs","href":"…","rel":"find-blogs"}]}GET /content
  20. 20. ContentCollectionsContentQueriesContentCategories
  21. 21. {"links" : [{"task": “work with blogs","href":"…","rel" : "blogs"},{"task": “work with video","href":"…","rel": "videos"}]}GET /content
  22. 22. {"links" : [{"task": "retrieve latest blogs","href":"…","rel" : "retrieve"},{"task": "find blogs","href":"…","rel":"search"}]}GET /blogs
  23. 23. Who are these relationships for?How are they going to be used?
  24. 24. PortalAPIDesign-Time/Development TimeRuntime
  25. 25. How am I going to get input fromthe client?
  26. 26. {"links" : [{"task": "retrieve latest blogs", "href":"","rel":"retrieve"}],"search" : [{"task": "find blogs","href" : "...","rel" : "search","input-fields" : [{"name" : "keyword", "type" : "string"},{"name" : "publish-date", "type" : "date"}]}]}GET /blogs
  27. 27. {"links" : [{"task": "retrieve latest blogs", "href":"","rel":"retrieve"}],"search" : [{"task": "find blogs","href" : "...","rel" : "search","input-fields" : [{"name" : "keyword", "type" : "string"},{"name" : "publish-date", "type" : "date"}]}]}GET /blogs
  28. 28. {"links" : [{"task": "retrieve latest blogs", "href":"","rel":"retrieve"}],"search" : [{"task": "find blogs","href" : "...","rel" : "search","input-fields" : [{"name" : "keyword", "type" : "string"},{"name" : "publish-date", "type" : "date"}{"name" : "author", "type" : “string"}]}]}GET /blogs
  29. 29. What about the user experience?
  30. 30. {"entities" : [{"title": "Making Government Data Easy to Find,Accessible & Usable", "href" : "..."},{"title": "If They Have to Ask, You Didn’t AffordIt", "href" : "..."},]"links" : [],"search" : []}
  31. 31. {"entities" : [{"title": "Nation Building in the Age of APIs","href" : "...“, “featured” : “true”},{"title": "Making Government Data Easy to Find,Accessible & Usable", "href" : "..."},{"title": "If They Have to Ask, You Didn’t AffordIt", "href" : "..."},]"links" : [],"search" : []}
  32. 32. Maze + XMLCollection + JSONJSON APIHALSIRENHTMLLots of hypermedia media types
  33. 33. Wait a second…Is this just HTML and a browser!?
  34. 34. State TransitionsPresentationInput FieldsRender
  35. 35. State TransitionsPresentationInput FieldsRender
  36. 36. State TransitionsPresentationInput FieldsRenderState TransitionsPresentationInput Fields
  37. 37. A hypermedia client strategy:1. Parse response2. Identify links3. Apply handlers4. Render
  38. 38. A different hypermedia clientstrategy:1. Parse response2. Select relevant data3. Follow hardcoded statetransition
  39. 39. Faithful SelectiveClient Spectrum
  40. 40. Faithful SelectiveClient SpectrumLess knowledgeof applicationMore knowledgeof application
  41. 41. Faithful SelectiveClient SpectrumLess knowledgeof applicationMore knowledgeof applicationEasier to change? Easier to innovate?
  42. 42. Will developers need to build‘smart’ clients?Not unless they need them
  43. 43. How hard will this be and is itreally worth it?The design effort feels similarto URI style design.Benefits are subjective.
  44. 44. Will it help my business?I’m still not sure.
  45. 45. Why isn’t everyone doing this?Designing for change isn’t ahigh priority?Hypermedia isn’t a universaltool.
  46. 46. My journey isn’t over…
  47. 47. … but it isn’t as scary as it used to be!
  48. 48. With special thanks to myhypermedia guideMike Amundsen
  49. 49. My Journey into the Terrifying World ofHypermediaRonnie MitraPrincipal API Architect - EuropeLayer 7 API Academy

×