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

Exist In the Web - Not on it

Exist In the Web - Not on it

A 30,000 ft view on how we can model our public web APIs close to how HTTP was designed to be used, and an illustration of what kinds of problems hypermedia web api can try and solve for your in your public web API.

Amy Palamountain

July 25, 2013
Tweet

More Decks by Amy Palamountain

Other Decks in Programming

Transcript

  1. wsdl/"targetNamespace="http://ws.c <wsdl:types> <s:schema elementFormDefault="qua <s:element name="GetWeatherInfor <s:complexType/> </s:element> <s:element name="GetWeatherInfor

    <s:complexType> <s:sequence> <s:element minOccurs="0" maxOc name="GetWeatherInformation type="tns:ArrayOfWeatherDes </s:complexType>
  2. e o C Sis t t n $.ajax({ url: '/music/catalog',

    success: function(){ // Parse the body and check for errors! }, error: function(){ // An error code would have been nice! } });
  3. R r

  4. r p

  5. HTTP GET ACCEPT : /catalog : text/html VIEW ALBUMS ABBA

    Their ‘gift’ to the world can be still be found today, in karaoke bars world wide. MEAT LOAF Meat Loaf’s father was an alcoholic who would go on drinking binges for days at a time. VIEW ALBUMS VIEW ALBUMS DAVID BOWIE He challenged the core belief of the rock music of its day & created perhaps the biggest cult in popular culture. THE PIXIES An unorthodox marriage of surf music and punk rock. Some of the most compelling music of the 80s VIEW ALBUMS http://musicstore.com/catalog
  6. PRE ORDER “Heroes” The twelfth studio album by David Bowie,

    released in 1977. The second instalment of his Berlin Trilogy. Ziggy Stardust & the Spiders from Mars Aladdin Sane Riding the wave of Ziggy Stardust, there's a wealth of classic material here, but not enough focus to make this album itself a classic. A rock star acts as a messenger for extraterrestrial beings BUY ALBUM http://musicstore.com/albums/bowie Young Americans David recorded the music for this album first. Mid session he would stop, write an idea down. He wrote the lyrics only after the music was recorded BUY ALBUM HTTP GET ACCEPT : /albums/bowie : text/html BUY ALBUM
  7. BUY ALBUM “Heroes” The twelfth studio album by David Bowie,

    released in 1977. The second instalment of his Berlin Trilogy. Ziggy Stardust & the Spiders from Mars Aladdin Sane Riding the wave of Ziggy Stardust, there's a wealth of classic material here, but not enough focus to make this album itself a classic. A rock star acts as a messenger for extraterrestrial beings BUY ALBUM http://musicstore.com/albums/bowie Young Americans David recorded the music for this album first. Mid session he would stop, write an idea down. He wrote the lyrics only after the music was recorded BUY ALBUM BUY ALBUM HTTP GET ACCEPT : /albums/bowie : text/html
  8. HTTP POST ACCEPT : /checkout : text/html Checkout “Heroes” The

    twelfth studio album by David Bowie, released in 1977. The second instalment of his Berlin Trilogy. http://musicstore.com/checkout Total: $10.00 You are purchasing... Name on card Credit Card # Verification Code
  9. LISTEN “Heroes” The twelfth studio album by David Bowie, released

    in 1977. The second instalment of his Berlin Trilogy. Ziggy Stardust & the Spiders from Mars Aladdin Sane Riding the wave of Ziggy Stardust, there's a wealth of classic material here, but not enough focus to make this album itself a classic. A rock star acts as a messenger for extraterrestrial beings BUY ALBUM http://musicstore.com/albums/bowie Young Americans David recorded the music for this album first. Mid session he would stop, write an idea down. He wrote the lyrics only after the music was recorded BUY ALBUM BUY ALBUM HTTP GET ACCEPT : /albums/bowie : text/html
  10. JSON LINKS "link": { "rel":"catalog", "title":"Catalog", "href":"/music/catalog" } HTML LINKS

    <link rel="catalog" title="Catalog" href="/music/catalog" />
  11. XML LINKS HTML LINKS <link rel="catalog" title="Catalog" href="/music/catalog" /> <link>

    <rel> catalog </rel> <title> Catalog </title> <href> /music/catalog </href> </link>
  12. HTTP GET ACCEPT : /catalog : application/xml <catalog> <artist> <name>David

    Bowie</name> <description>.....</description> <links> <link> <rel> Albums </rel> <title> List Albums </title> <href> /albums/bowie </href> </link> ...... </links> </artist> ....... </catalog>
  13. <albums> <album> <name>Aladdin Sane</name> <description>.....</description> <links> <link> <rel> Purchase </rel>

    <title>Buy Now</title> <href> /checkout </href> </link> <link> <rel> Album Preview </rel> <title>Preview Tracks</title> <href> /albums/bowie/aladdinsane/preview </href> </link> ...... </links> </album> HTTP GET ACCEPT : /albums/bowie : application/xml
  14. <albums> <album> <name>Aladdin Sane</name> <description>.....</description> <links> <link> <rel> Stream </rel>

    <title>Listen</title> <href> /albums/bowie/aladdinsane/listen</href> </link> <link> <rel> Related Artists </rel> <title>Other Albums You Might Like</title> <href> /albums/similar/bowie</href> </link> ...... </links> </album> HTTP GET ACCEPT : /albums/bowie : application/xml
  15. Thank you! @ammeep amy.palamounta.in internet related activities: greenbutton.com google: hypermedia

    apis bizcoder.com stateless.co/hal_specification.html @alliebrosh for the hyperboleandahalf character