Linking for Fun and Profit: Using Linksets in APIs

API Specifications Conference (ASC) 2022 [https://events.linuxfoundation.org/openapi-asc/]

Erik Wilde
Axway Catalyst

September 20, 2022

Creative Commons License [https://creativecommons.org/licenses/by/4.0/]

This work is licensed under a CC
Attribution 4.0 International License
[https://creativecommons.org/licenses/by/4.0/]

Contents Erik Wilde : Linking for Fun and Profit: Using Linksets in APIs

Contents

Introduction

Outline (Introduction)

  1. Introduction [2]
  2. Linkset Motivation [7]
  3. RFC 9264 [2]
  4. Example: GS1 Digital Link [4]
  5. Conclusions [3]
Introduction Erik Wilde : Linking for Fun and Profit: Using Linksets in APIs

(3) Axway [https://www.axway.com] Catalysts [https://catalysts.axway.com]

Catalysts Logo

Introduction Erik Wilde : Linking for Fun and Profit: Using Linksets in APIs

(4) Erik Wilde [https://twitter.com/dret]



Linkset MotivationHTTP APIs

Outline (Linkset Motivation)

  1. Introduction [2]
  2. Linkset Motivation [7]
  3. RFC 9264 [2]
  4. Example: GS1 Digital Link [4]
  5. Conclusions [3]
Linkset Motivation Erik Wilde : Linking for Fun and Profit: Using Linksets in APIs

(6) Building Blocks for HTTP APIs [https://datatracker.ietf.org/wg/httpapi/about/]



Linkset Motivation Erik Wilde : Linking for Fun and Profit: Using Linksets in APIs

(7) One Model To Link Them All



Linkset Motivation Erik Wilde : Linking for Fun and Profit: Using Linksets in APIs

(9) Linkset Example

HTTP/1.1 200 OK
Date: Mon, 12 Aug 2019 10:35:51 GMT
Server: Apache-Coyote/1.1
Content-Type: application/linkset
Content-Length: 1023

<https://authors.example.net/johndoe>
   ; rel="author"
   ; type="application/rdf+xml"
   ; anchor="https://example.org/resource1",
<https://example.org/resource1?version=3>
   ; rel="latest-version"
   ; type="text/html"
   ; anchor="https://example.org/resource1",
<https://example.org/resource1?version=2>
   ; rel="predecessor-version"
   ; type="text/html"
   ; anchor="https://example.org/resource1?version=3",
<https://example.org/resource1?version=1>
   ; rel="predecessor-version"
   ; type="text/html"
   ; anchor="https://example.org/resource1?version=2",
<https://example.org/resource1?version=1>
   ; rel="memento"
   ; type="text/html"
   ; datetime="Thu, 13 Jun 2019 09:34:33 GMT"
   ; anchor="https://example.org/resource1",
<https://example.org/resource1?version=2>
   ; rel="memento"
   ; type="text/html"
   ; datetime="Sun, 21 Jul 2019 12:22:04 GMT"
   ; anchor="https://example.org/resource1",
<https://authors.example.net/alice>
   ; rel="author"
   ; anchor="https://example.org/resource1#comment=1"


Linkset Motivation Erik Wilde : Linking for Fun and Profit: Using Linksets in APIs

(10) Linkset Example (JSON)

HTTP/1.1 200 OK
Date: Mon, 12 Aug 2019 10:46:22 GMT
Server: Apache-Coyote/1.1
Content-Type: application/linkset+json
Content-Length: 1246

{ "linkset":
  [
    { "anchor": "https://example.org/resource1",
      "author": [
        { "href": "https://authors.example.net/johndoe",
          "type": "application/rdf+xml"
        }
      ],
      "memento": [
        { "href": "https://example.org/resource1?version=1",
          "type": "text/html",
          "datetime": "Thu, 13 Jun 2019 09:34:33 GMT"
        },
        { "href": "https://example.org/resource1?version=2",
          "type": "text/html",
          "datetime": "Sun, 21 Jul 2019 12:22:04 GMT"
        }
      ],
      "latest-version": [
        { "href": "https://example.org/resource1?version=3",
          "type": "text/html"
        }
      ]
    },
    { "anchor": "https://example.org/resource1?version=3",
      "predecessor-version": [
        { "href": "https://example.org/resource1?version=2",
          "type": "text/html"
        }
      ]
    },
    { "anchor": "https://example.org/resource1?version=2",
      "predecessor-version": [
        { "href": "https://example.org/resource1?version=1",
          "type": "text/html"
        }
      ]
    },
    { "anchor": "https://example.org/resource1#comment=1",
      "author": [
        { "href": "https://authors.example.net/alice"}
      ]
    }
  ]
}


Linkset Motivation Erik Wilde : Linking for Fun and Profit: Using Linksets in APIs

(11) Too Many Links



Linkset Motivation Erik Wilde : Linking for Fun and Profit: Using Linksets in APIs

(12) Third Party Links



RFC 9264

Outline (RFC 9264)

  1. Introduction [2]
  2. Linkset Motivation [7]
  3. RFC 9264 [2]
  4. Example: GS1 Digital Link [4]
  5. Conclusions [3]
RFC 9264 Erik Wilde : Linking for Fun and Profit: Using Linksets in APIs

(14) Linkset History

linkset-history.png

RFC 9264 Erik Wilde : Linking for Fun and Profit: Using Linksets in APIs

(15) RFC 9264: What's in the Specification?



Example: GS1 Digital Link

Outline (Example: GS1 Digital Link)

  1. Introduction [2]
  2. Linkset Motivation [7]
  3. RFC 9264 [2]
  4. Example: GS1 Digital Link [4]
  5. Conclusions [3]
Example: GS1 Digital Link Erik Wilde : Linking for Fun and Profit: Using Linksets in APIs

(17) GS1: Barcodes for Every Thing

gs1.png

Example: GS1 Digital Link Erik Wilde : Linking for Fun and Profit: Using Linksets in APIs

(18) Barcodes are going 2D

dal-giardino-qr.png

Example: GS1 Digital Link Erik Wilde : Linking for Fun and Profit: Using Linksets in APIs

(19) Product Page for Humans

dal-giardino-html.png

Example: GS1 Digital Link Erik Wilde : Linking for Fun and Profit: Using Linksets in APIs

(20) Product Linkset for Machines

$ curl -H "Accept: application/linkset+json" https://id.gs1.org/01/09506000134352
{
  "linkset": {
    "anchor": "https://id.gs1.org/01/09506000134352",
    "itemDescription": "Dal Giardino Risotto Rice with Musrooms 411 gr",
    "https://gs1.org/voc/defaultLink": [
      {
        "href": "https://dalgiardino.com/risotto-rice-with-mushrooms/",
        "title": "Product information"
      }
    ],
    "https://gs1.org/voc/defaultLinkMulti": [
      {
        "href": "https://dalgiardino.com/risotto-rice-with-mushrooms/",
        "title": "Product information",
        "type": "text/html",
        "hreflang": [ "en" ]
      },
      {
        "href": "https://dalgiardino.com/risotto-rice-with-mushrooms/index.html.es",
        "title": "Información del Producto",
        "type": "text/html",
        "hreflang": [ "es" ]
      },
      {
        "href": "https://dalgiardino.com/risotto-rice-with-mushrooms/index.html.ja",
        "title": "Product information",
        "type": "text/html",
        "hreflang": [ "ja" ]
      },
      {
        "href": "https://dalgiardino.com/risotto-rice-with-mushrooms/index.html.vi",
        "title": "Trang thông tin sản phẩm",
        "type": "text/html",
        "hreflang": [ "vi" ]
      }
    ],
    "https://gs1.org/voc/hasRetailers": [
      {
        "href": "https://dalgiardino.com/where-to-buy/",
        "title": "Where to buy",
        "type": "text/html",
        "hreflang": [ "en" ]
      },
      {
        "href": "https://dalgiardino.com/where-to-buy/index.html.es",
        "title": "Donde comprar Dal Giardino",
        "type": "text/html",
        "hreflang": [ "es" ]
      },
      {
        "href": "https://dalgiardino.com/where-to-buy/index.html.vi",
        "title": "Nơi bán",
        "type": "text/html",
        "hreflang": [ "vi" ]
      }
    ],
    "https://gs1.org/voc/pip": [
      {
        "href": "https://dalgiardino.com/risotto-rice-with-mushrooms/",
        "title": "Product information",
        "type": "text/html",
        "hreflang": [ "en" ]
      },
      {
        "href": "https://dalgiardino.com/risotto-rice-with-mushrooms/index.html.es",
        "title": "Información del Producto",
        "type": "text/html",
        "hreflang": [ "es" ]
      },
      {
        "href": "https://dalgiardino.com/risotto-rice-with-mushrooms/index.html.ja",
        "title": "Product information",
        "type": "text/html",
        "hreflang": [ "ja" ]
      },
      {
        "href": "https://dalgiardino.com/risotto-rice-with-mushrooms/index.html.vi",
        "title": "Trang thông tin sản phẩm",
        "type": "text/html",
        "hreflang": [ "vi" ]
      }
    ],
    "https://gs1.org/voc/recipeInfo": [
      {
        "href": "https://dalgiardino.com/mushroom-squash-risotto/",
        "title": "Wild Mushroom And Butternut Squash Risotto",
        "type": "text/html",
        "hreflang": [ "en" ]
      },
      {
        "href": "https://dalgiardino.com/mushroom-squash-risotto/index.html.es",
        "title": "Recetas",
        "type": "text/html",
        "hreflang": [ "es" ]
      },
      {
        "href": "https://dalgiardino.com/mushroom-squash-risotto/index.html.ja",
        "title": "キノコと砕いたバターナッツ入りのリゾット",
        "type": "text/html",
        "hreflang": [
          "ja"
        ]
      }
    ],
    "https://gs1.org/voc/sustainabilityInfo": [
      {
        "href": "https://dalgiardino.com/about/",
        "title": "About Dal Giardino",
        "type": "text/html",
        "hreflang": [
          "en"
        ]
      },
      {
        "href": "https://dalgiardino.com/about/index.html.es",
        "title": "Sobre Dal Giardino",
        "type": "text/html",
        "hreflang": [
          "es"
        ]
      },
      {
        "href": "https://dalgiardino.com/about/index.html.vi",
        "title": "Phát triển bền vững và t",
        "type": "text/html",
        "hreflang": [
          "vi"
        ]
      }
    ]
  }
}


Conclusions

Outline (Conclusions)

  1. Introduction [2]
  2. Linkset Motivation [7]
  3. RFC 9264 [2]
  4. Example: GS1 Digital Link [4]
  5. Conclusions [3]
Conclusions Erik Wilde : Linking for Fun and Profit: Using Linksets in APIs

(22) Keep Calm and Design APIs!

taj-mahal-lego.png

Conclusions Erik Wilde : Linking for Fun and Profit: Using Linksets in APIs

(23) Thank you for your support!

Thank You

Conclusions Erik Wilde : Linking for Fun and Profit: Using Linksets in APIs

(24) Thank You!

This is the End

September 20, 2022 API Specifications Conference (ASC) 2022 [https://events.linuxfoundation.org/openapi-asc/]