Hypermedia

API Course Politecnico di Milano

Erik Wilde , API Academy, CA Technologies
March 28, 2018

Creative Commons License [http://creativecommons.org/licenses/by/3.0/]

This work is licensed under a CC
Attribution 3.0 Unported License
[http://creativecommons.org/licenses/by/3.0/]

Contents Erik Wilde : Hypermedia

Contents

Web Linking

Outline (Web Linking)

  1. Web Linking [4]
  2. Hypermedia Overview [3]
  3. Hypermedia Design [4]
  4. Hypermedia Formats [2]
  5. Conclusions [2]
Web Linking Erik Wilde : Hypermedia

(4) Web Linking for APIs



Hypermedia Overview

Outline (Hypermedia Overview)

  1. Web Linking [4]
  2. Hypermedia Overview [3]
  3. Hypermedia Design [4]
  4. Hypermedia Formats [2]
  5. Conclusions [2]
Hypermedia Overview Erik Wilde : Hypermedia

(8) Hypermedia and Affordances

When I say hypertext, I mean the simultaneous presentation of information and controls such that the information becomes the affordance through which the user (or automaton) obtains choices and selects actions. [http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven] (Roy Fielding [https://en.wikipedia.org/wiki/Roy_Fielding])


Hypermedia Overview Erik Wilde : Hypermedia

(9) Hypermedia and Workflows



Hypermedia Overview Erik Wilde : Hypermedia

(10) Hypermedia and API Evolution



Hypermedia Design

Outline (Hypermedia Design)

  1. Web Linking [4]
  2. Hypermedia Overview [3]
  3. Hypermedia Design [4]
  4. Hypermedia Formats [2]
  5. Conclusions [2]
Hypermedia Design Erik Wilde : Hypermedia

(13) Link Representation (JSON Feed Format)

{
    "version": "https://jsonfeed.org/version/1",
    "title": "My Example Feed",
    "home_page_url": "https://example.org/",
    "feed_url": "https://example.org/feed.json",
    "items": [
        {
            "id": "2",
            "content_text": "This is a second item.",
            "url": "https://example.org/second-item"
        },
        {
            "id": "1",
            "content_html": "<p>Hello, world!</p>",
            "url": "https://example.org/initial-post"
        }
    ]
}


Hypermedia Design Erik Wilde : Hypermedia

(15) Typed Links (HAL Format)

    "currentlyProcessing": 14,
    "shippedToday": 20,
    "_embedded": {
        "http://example.com/docs/rels/order": [{
            "_links": {
                "self": { "href": "/orders/123" },
                "http://example.com/docs/rels/basket": { "href": "/baskets/98712" },
                "http://example.com/docs/rels/customer": { "href": "/customers/7809" }
            },
            "total": 30.00,
            "currency": "USD",
            "status": "shipped"
        }, {
            "_links": {
                "self": { "href": "/orders/124" },
                "http://example.com/docs/rels/basket": { "href": "/baskets/97213" },
                "http://example.com/docs/rels/customer": { "href": "/customers/12369" }
            },
            "total": 20.00,
            "currency": "USD",
            "status": "processing"


Hypermedia Formats

Outline (Hypermedia Formats)

  1. Web Linking [4]
  2. Hypermedia Overview [3]
  3. Hypermedia Design [4]
  4. Hypermedia Formats [2]
  5. Conclusions [2]
Hypermedia Formats Erik Wilde : Hypermedia

(17) Specific Hypermedia Formats



Hypermedia Formats Erik Wilde : Hypermedia

(18) Generic Hypermedia Formats



Conclusions

Outline (Conclusions)

  1. Web Linking [4]
  2. Hypermedia Overview [3]
  3. Hypermedia Design [4]
  4. Hypermedia Formats [2]
  5. Conclusions [2]
Conclusions Erik Wilde : Hypermedia

(20) The Web Pattern



Conclusions Erik Wilde : Hypermedia

(21) Thanks! Q&A

What's Next?

March 28, 2018 API Course Politecnico di Milano