SlideShare a Scribd company logo
@serialseb
                 seb@serialseb.com
       http://codebetter.com/sebastienlambla/


Architect, trainer, speaker, developer, mayhem
                     inducer…
by the people, for the people
Web Development Done Right
Building Hypermedia APIs

Why links and forms will make your
        ReSTful API better
Links, forms and unicorns

Building Hypermedia APIs

Why links and forms will make your
        ReSTful API better
Your mission should you accept it…
• Go to Paris, give the agent your name and ask
  for his favourite monument
• Go to Brussels, tell the agent what you learnt,
  ask for their favourite food
• Go to Copenhagen, tell them what you learnt,
  ask for their favourite painter
• In Malmo, tell them what you learnt, receive
  the secret message
Your mission should you accept it…
• POST to /paris, expect {“status”: “ok”,
  “monument”: ??}
• POST to /brussels with {“monument”: ??},
  expect {“status”: “ok”, “food”: ??}
• POST to /copenhagen with {“food”: ??},
  expect {“status”:”ok”, “artist”: ??}
• POST to /malmo with {“artist”: ??}, expect
  {“status”: “ok”, “secret”: ??}
public void travel() {
  var response = _client
              .Post(“/paris”, new{name=“Pixie”})
              .Send();
  if (response.body.status == “ok”) {
    response = _client.Post(“/brussels”, new {
      monument=response.body.monument
    }).Send();
    // etc
  }
}
> POST /paris
> {“name”: “resty galore”}
Oh no!

The French don’t speak English!
         (who knew!)
> POST /paris
> {“name”: “resty galore”}

< 200 OK
< {“status”: “oui”, “monument”: “eiffel tower”}
public void travel() {
  var response = _client
              .Post(“/paris”, new{name=“Pixie”})
              .Send();
  if (response.status == 200) {
    response = _client.Post(“/brussels”, new {
      monument=response.body.monument
    }).Send();
    // etc
  }
}
> POST /paris
> {“name”: “resty galore”}

< 200 OK
< {“monument”: “eiffel tower”}
> POST /brussels
> {“monument”: “eiffel tower”}
Oh no!

The Belgium agent was captured and
    the message is now London!
> POST /brussels
> {“monument”: “eiffel tower”}

< 410 Gone somewhere colder
We could send an agent to
Brussels to warn Resty Galore…
> POST /brussels
> {“monument”: “eiffel tower”}

< 307 Redirect to London, quick!
Keeping agents in each location we need to
           redirect is expensive.

   Travelling for nothing is also expensive.

Or Resty Galore could start her journey with…
Keeping agents in each location we need to
           redirect is expensive.

Or Resty Galore could start her journey with…
> POST /paris
> {“name”: “resty galore”}

< 200 OK
< Link: </london>; rel=“next”
< {“monument”: “eiffel tower”}
public void travel() {
  var response = _client
              .Post(“/paris”, new{name=“Pixie”})
              .Send();
  if (response.status == 200) {
    response = _client.Post(response.links.next, new {
      monument = response.body.monument
    }).Send();
    // etc
  }
}
> POST /london
> {“monument”: “eiffel tower”}

< 418 I’m a teapot
<
<
<
<
<
> POST /london
> {“monument”: “eiffel tower”}

< 200 OK
< Link: </copenhagen>; rel=“next”
< {“food”: “Chicken Tikka Massala”}
> POST /copenhagen
> {“monument”: “eiffel tower”}
Oh no!

The Danish wants more security and
   require both the food and the
            monument!
> POST /copenhagen
> {“monument”: “eiffel tower”}

< 400 Bad request dudette
Forms
>   GET /copenhagen
<   200 OK
<   {“form”: {
<      “monument”: null,
<      “food”: null
<   }}

>   POST /copenhagen
>   {“monument”: “eiffel tower”,
>    “food”: “Chicken Tikka Massala”}
<   200 OK
<   Link: </malmo>; rel=“next”
<   {“author”: “hans christian andersen”}
>   GET /malmo
<   200 OK
<   {“form”: {
<      “author”: null
<   }}
Oh no!

The agent in Malmo is a Mole! They
   have to be decommissioned!
>   GET /malmo
<   200 OK
<   {“form”: {
<      “author”: null
<   }}

>   POST /malmo
>   {“author”: “hans christian andersen”}
<   200 OK
<   {“secret”: “not yet…”}
Forms with control data
>   GET /malmo
<   200 OK
<   {“form”: {
<      “method”: “DELETE”
<      “href”: “/malmo/mole”
<   }}

> DELETE /malmo/mole
> 200 OK
< {“secret”: “ReST is amazing.”}
We lowered coupling by…
• Respecting the Uniform Interface (status
  codes, verbs…)
• Introducing Links to navigate
• Introducing forms to know what to send
• Introducing control data in forms to enable a
  change in workflow with no change in the
  client code.
• OpenRasta - http://openrasta.org
• OpenWrap – http://openwrap.org

• Web linking -
  http://tools.ietf.org/html/rfc5988

More Related Content

Viewers also liked

Gophercon 2016 Communicating Sequential Goroutines
Gophercon 2016 Communicating Sequential GoroutinesGophercon 2016 Communicating Sequential Goroutines
Gophercon 2016 Communicating Sequential Goroutines
Adrian Cockcroft
 
Microxchg Analyzing Response Time Distributions for Microservices
Microxchg Analyzing Response Time Distributions for MicroservicesMicroxchg Analyzing Response Time Distributions for Microservices
Microxchg Analyzing Response Time Distributions for Microservices
Adrian Cockcroft
 
When Developers Operate and Operators Develop
When Developers Operate and Operators DevelopWhen Developers Operate and Operators Develop
When Developers Operate and Operators Develop
Adrian Cockcroft
 
Microservices Application Tracing Standards and Simulators - Adrians at OSCON
Microservices Application Tracing Standards and Simulators - Adrians at OSCONMicroservices Application Tracing Standards and Simulators - Adrians at OSCON
Microservices Application Tracing Standards and Simulators - Adrians at OSCON
Adrian Cockcroft
 
Microservices: What's Missing - O'Reilly Software Architecture New York
Microservices: What's Missing - O'Reilly Software Architecture New YorkMicroservices: What's Missing - O'Reilly Software Architecture New York
Microservices: What's Missing - O'Reilly Software Architecture New York
Adrian Cockcroft
 
Innovation and Architecture
Innovation and ArchitectureInnovation and Architecture
Innovation and Architecture
Adrian Cockcroft
 
Microservices Workshop - Craft Conference
Microservices Workshop - Craft ConferenceMicroservices Workshop - Craft Conference
Microservices Workshop - Craft Conference
Adrian Cockcroft
 
In Search of Segmentation
In Search of SegmentationIn Search of Segmentation
In Search of Segmentation
Adrian Cockcroft
 
Scalable Microservices at Netflix. Challenges and Tools of the Trade
Scalable Microservices at Netflix. Challenges and Tools of the TradeScalable Microservices at Netflix. Challenges and Tools of the Trade
Scalable Microservices at Netflix. Challenges and Tools of the Trade
C4Media
 
Monitoring Challenges - Monitorama 2016 - Monitoringless
Monitoring Challenges - Monitorama 2016 - MonitoringlessMonitoring Challenges - Monitorama 2016 - Monitoringless
Monitoring Challenges - Monitorama 2016 - Monitoringless
Adrian Cockcroft
 
MicroServices at Netflix - challenges of scale
MicroServices at Netflix - challenges of scaleMicroServices at Netflix - challenges of scale
MicroServices at Netflix - challenges of scale
Sudhir Tonse
 
Microservices Workshop All Topics Deck 2016
Microservices Workshop All Topics Deck 2016Microservices Workshop All Topics Deck 2016
Microservices Workshop All Topics Deck 2016
Adrian Cockcroft
 
Evolution of Microservices - Craft Conference
Evolution of Microservices - Craft ConferenceEvolution of Microservices - Craft Conference
Evolution of Microservices - Craft Conference
Adrian Cockcroft
 
Dockercon State of the Art in Microservices
Dockercon State of the Art in MicroservicesDockercon State of the Art in Microservices
Dockercon State of the Art in Microservices
Adrian Cockcroft
 

Viewers also liked (14)

Gophercon 2016 Communicating Sequential Goroutines
Gophercon 2016 Communicating Sequential GoroutinesGophercon 2016 Communicating Sequential Goroutines
Gophercon 2016 Communicating Sequential Goroutines
 
Microxchg Analyzing Response Time Distributions for Microservices
Microxchg Analyzing Response Time Distributions for MicroservicesMicroxchg Analyzing Response Time Distributions for Microservices
Microxchg Analyzing Response Time Distributions for Microservices
 
When Developers Operate and Operators Develop
When Developers Operate and Operators DevelopWhen Developers Operate and Operators Develop
When Developers Operate and Operators Develop
 
Microservices Application Tracing Standards and Simulators - Adrians at OSCON
Microservices Application Tracing Standards and Simulators - Adrians at OSCONMicroservices Application Tracing Standards and Simulators - Adrians at OSCON
Microservices Application Tracing Standards and Simulators - Adrians at OSCON
 
Microservices: What's Missing - O'Reilly Software Architecture New York
Microservices: What's Missing - O'Reilly Software Architecture New YorkMicroservices: What's Missing - O'Reilly Software Architecture New York
Microservices: What's Missing - O'Reilly Software Architecture New York
 
Innovation and Architecture
Innovation and ArchitectureInnovation and Architecture
Innovation and Architecture
 
Microservices Workshop - Craft Conference
Microservices Workshop - Craft ConferenceMicroservices Workshop - Craft Conference
Microservices Workshop - Craft Conference
 
In Search of Segmentation
In Search of SegmentationIn Search of Segmentation
In Search of Segmentation
 
Scalable Microservices at Netflix. Challenges and Tools of the Trade
Scalable Microservices at Netflix. Challenges and Tools of the TradeScalable Microservices at Netflix. Challenges and Tools of the Trade
Scalable Microservices at Netflix. Challenges and Tools of the Trade
 
Monitoring Challenges - Monitorama 2016 - Monitoringless
Monitoring Challenges - Monitorama 2016 - MonitoringlessMonitoring Challenges - Monitorama 2016 - Monitoringless
Monitoring Challenges - Monitorama 2016 - Monitoringless
 
MicroServices at Netflix - challenges of scale
MicroServices at Netflix - challenges of scaleMicroServices at Netflix - challenges of scale
MicroServices at Netflix - challenges of scale
 
Microservices Workshop All Topics Deck 2016
Microservices Workshop All Topics Deck 2016Microservices Workshop All Topics Deck 2016
Microservices Workshop All Topics Deck 2016
 
Evolution of Microservices - Craft Conference
Evolution of Microservices - Craft ConferenceEvolution of Microservices - Craft Conference
Evolution of Microservices - Craft Conference
 
Dockercon State of the Art in Microservices
Dockercon State of the Art in MicroservicesDockercon State of the Art in Microservices
Dockercon State of the Art in Microservices
 

Similar to Links, forms and unicorns

JSON and the APInauts
JSON and the APInautsJSON and the APInauts
JSON and the APInauts
Wynn Netherland
 
Api vortrag
Api vortragApi vortrag
Api vortrag
Tobias Wolf
 
Building Next-Generation Web APIs with JSON-LD and Hydra
Building Next-Generation Web APIs with JSON-LD and HydraBuilding Next-Generation Web APIs with JSON-LD and Hydra
Building Next-Generation Web APIs with JSON-LD and Hydra
Markus Lanthaler
 
Teaming up WordPress API with Backbone.js in Titanium
Teaming up WordPress API with Backbone.js in TitaniumTeaming up WordPress API with Backbone.js in Titanium
Teaming up WordPress API with Backbone.js in Titanium
Jeroen van Dijk
 
Aesthetics and the Beauty of an Architecture
Aesthetics and the Beauty of an ArchitectureAesthetics and the Beauty of an Architecture
Aesthetics and the Beauty of an Architecture
Tom Scott
 
Eve - REST API for Humans™
Eve - REST API for Humans™Eve - REST API for Humans™
Eve - REST API for Humans™
Nicola Iarocci
 
Chloe and the Realtime Web
Chloe and the Realtime WebChloe and the Realtime Web
Chloe and the Realtime Web
Trotter Cashion
 
Couchbase presentation - by Patrick Heneise
Couchbase presentation - by Patrick HeneiseCouchbase presentation - by Patrick Heneise
Couchbase presentation - by Patrick Heneise
itnig
 
Elasticsearch
ElasticsearchElasticsearch
Elasticsearch
Michal Vrchota
 
CSS3 Transforms Transitions and Animations
CSS3 Transforms Transitions and AnimationsCSS3 Transforms Transitions and Animations
CSS3 Transforms Transitions and Animations
Inayaili León
 
Vorstellung von VeRST, einem Framework zur Schnittstellenversionierung
Vorstellung von VeRST, einem Framework zur SchnittstellenversionierungVorstellung von VeRST, einem Framework zur Schnittstellenversionierung
Vorstellung von VeRST, einem Framework zur Schnittstellenversionierung
OPEN KNOWLEDGE GmbH
 
Idiomatic spock
Idiomatic spockIdiomatic spock
Idiomatic spock
GR8Conf
 
Forbes MongoNYC 2011
Forbes MongoNYC 2011Forbes MongoNYC 2011
Forbes MongoNYC 2011
djdunlop
 
Consul ou comment bien tirer sur l’élastique
 Consul ou comment bien tirer sur l’élastique Consul ou comment bien tirer sur l’élastique
Consul ou comment bien tirer sur l’élastique
Nicolas Ledez
 
AnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time webAnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time web
clkao
 
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedGraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learned
MarcinStachniuk
 

Similar to Links, forms and unicorns (16)

JSON and the APInauts
JSON and the APInautsJSON and the APInauts
JSON and the APInauts
 
Api vortrag
Api vortragApi vortrag
Api vortrag
 
Building Next-Generation Web APIs with JSON-LD and Hydra
Building Next-Generation Web APIs with JSON-LD and HydraBuilding Next-Generation Web APIs with JSON-LD and Hydra
Building Next-Generation Web APIs with JSON-LD and Hydra
 
Teaming up WordPress API with Backbone.js in Titanium
Teaming up WordPress API with Backbone.js in TitaniumTeaming up WordPress API with Backbone.js in Titanium
Teaming up WordPress API with Backbone.js in Titanium
 
Aesthetics and the Beauty of an Architecture
Aesthetics and the Beauty of an ArchitectureAesthetics and the Beauty of an Architecture
Aesthetics and the Beauty of an Architecture
 
Eve - REST API for Humans™
Eve - REST API for Humans™Eve - REST API for Humans™
Eve - REST API for Humans™
 
Chloe and the Realtime Web
Chloe and the Realtime WebChloe and the Realtime Web
Chloe and the Realtime Web
 
Couchbase presentation - by Patrick Heneise
Couchbase presentation - by Patrick HeneiseCouchbase presentation - by Patrick Heneise
Couchbase presentation - by Patrick Heneise
 
Elasticsearch
ElasticsearchElasticsearch
Elasticsearch
 
CSS3 Transforms Transitions and Animations
CSS3 Transforms Transitions and AnimationsCSS3 Transforms Transitions and Animations
CSS3 Transforms Transitions and Animations
 
Vorstellung von VeRST, einem Framework zur Schnittstellenversionierung
Vorstellung von VeRST, einem Framework zur SchnittstellenversionierungVorstellung von VeRST, einem Framework zur Schnittstellenversionierung
Vorstellung von VeRST, einem Framework zur Schnittstellenversionierung
 
Idiomatic spock
Idiomatic spockIdiomatic spock
Idiomatic spock
 
Forbes MongoNYC 2011
Forbes MongoNYC 2011Forbes MongoNYC 2011
Forbes MongoNYC 2011
 
Consul ou comment bien tirer sur l’élastique
 Consul ou comment bien tirer sur l’élastique Consul ou comment bien tirer sur l’élastique
Consul ou comment bien tirer sur l’élastique
 
AnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time webAnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time web
 
GraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learnedGraphQL - when REST API is to less - lessons learned
GraphQL - when REST API is to less - lessons learned
 

Recently uploaded

Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
CAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on BlockchainCAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on Blockchain
Claudio Di Ciccio
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdfAI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
Techgropse Pvt.Ltd.
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 

Recently uploaded (20)

Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
CAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on BlockchainCAKE: Sharing Slices of Confidential Data on Blockchain
CAKE: Sharing Slices of Confidential Data on Blockchain
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdfAI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
AI-Powered Food Delivery Transforming App Development in Saudi Arabia.pdf
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 

Links, forms and unicorns

  • 1. @serialseb seb@serialseb.com http://codebetter.com/sebastienlambla/ Architect, trainer, speaker, developer, mayhem inducer…
  • 2. by the people, for the people
  • 4. Building Hypermedia APIs Why links and forms will make your ReSTful API better
  • 5. Links, forms and unicorns Building Hypermedia APIs Why links and forms will make your ReSTful API better
  • 6.
  • 7.
  • 8.
  • 9. Your mission should you accept it… • Go to Paris, give the agent your name and ask for his favourite monument • Go to Brussels, tell the agent what you learnt, ask for their favourite food • Go to Copenhagen, tell them what you learnt, ask for their favourite painter • In Malmo, tell them what you learnt, receive the secret message
  • 10. Your mission should you accept it… • POST to /paris, expect {“status”: “ok”, “monument”: ??} • POST to /brussels with {“monument”: ??}, expect {“status”: “ok”, “food”: ??} • POST to /copenhagen with {“food”: ??}, expect {“status”:”ok”, “artist”: ??} • POST to /malmo with {“artist”: ??}, expect {“status”: “ok”, “secret”: ??}
  • 11. public void travel() { var response = _client .Post(“/paris”, new{name=“Pixie”}) .Send(); if (response.body.status == “ok”) { response = _client.Post(“/brussels”, new { monument=response.body.monument }).Send(); // etc } }
  • 12. > POST /paris > {“name”: “resty galore”}
  • 13. Oh no! The French don’t speak English! (who knew!)
  • 14. > POST /paris > {“name”: “resty galore”} < 200 OK < {“status”: “oui”, “monument”: “eiffel tower”}
  • 15. public void travel() { var response = _client .Post(“/paris”, new{name=“Pixie”}) .Send(); if (response.status == 200) { response = _client.Post(“/brussels”, new { monument=response.body.monument }).Send(); // etc } }
  • 16. > POST /paris > {“name”: “resty galore”} < 200 OK < {“monument”: “eiffel tower”}
  • 17.
  • 18. > POST /brussels > {“monument”: “eiffel tower”}
  • 19. Oh no! The Belgium agent was captured and the message is now London!
  • 20. > POST /brussels > {“monument”: “eiffel tower”} < 410 Gone somewhere colder
  • 21. We could send an agent to Brussels to warn Resty Galore…
  • 22. > POST /brussels > {“monument”: “eiffel tower”} < 307 Redirect to London, quick!
  • 23. Keeping agents in each location we need to redirect is expensive. Travelling for nothing is also expensive. Or Resty Galore could start her journey with…
  • 24. Keeping agents in each location we need to redirect is expensive. Or Resty Galore could start her journey with…
  • 25.
  • 26. > POST /paris > {“name”: “resty galore”} < 200 OK < Link: </london>; rel=“next” < {“monument”: “eiffel tower”}
  • 27. public void travel() { var response = _client .Post(“/paris”, new{name=“Pixie”}) .Send(); if (response.status == 200) { response = _client.Post(response.links.next, new { monument = response.body.monument }).Send(); // etc } }
  • 28. > POST /london > {“monument”: “eiffel tower”} < 418 I’m a teapot < < < < <
  • 29. > POST /london > {“monument”: “eiffel tower”} < 200 OK < Link: </copenhagen>; rel=“next” < {“food”: “Chicken Tikka Massala”}
  • 30.
  • 31. > POST /copenhagen > {“monument”: “eiffel tower”}
  • 32. Oh no! The Danish wants more security and require both the food and the monument!
  • 33. > POST /copenhagen > {“monument”: “eiffel tower”} < 400 Bad request dudette
  • 34. Forms
  • 35. > GET /copenhagen < 200 OK < {“form”: { < “monument”: null, < “food”: null < }} > POST /copenhagen > {“monument”: “eiffel tower”, > “food”: “Chicken Tikka Massala”} < 200 OK < Link: </malmo>; rel=“next” < {“author”: “hans christian andersen”}
  • 36.
  • 37. > GET /malmo < 200 OK < {“form”: { < “author”: null < }}
  • 38. Oh no! The agent in Malmo is a Mole! They have to be decommissioned!
  • 39.
  • 40. > GET /malmo < 200 OK < {“form”: { < “author”: null < }} > POST /malmo > {“author”: “hans christian andersen”} < 200 OK < {“secret”: “not yet…”}
  • 42. > GET /malmo < 200 OK < {“form”: { < “method”: “DELETE” < “href”: “/malmo/mole” < }} > DELETE /malmo/mole > 200 OK < {“secret”: “ReST is amazing.”}
  • 43.
  • 44.
  • 45. We lowered coupling by… • Respecting the Uniform Interface (status codes, verbs…) • Introducing Links to navigate • Introducing forms to know what to send • Introducing control data in forms to enable a change in workflow with no change in the client code.
  • 46. • OpenRasta - http://openrasta.org • OpenWrap – http://openwrap.org • Web linking - http://tools.ietf.org/html/rfc5988