SlideShare uma empresa Scribd logo
1 de 46
@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

Mais conteúdo relacionado

Destaque

Gophercon 2016 Communicating Sequential Goroutines
Gophercon 2016 Communicating Sequential GoroutinesGophercon 2016 Communicating Sequential Goroutines
Gophercon 2016 Communicating Sequential GoroutinesAdrian 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 MicroservicesAdrian Cockcroft
 
When Developers Operate and Operators Develop
When Developers Operate and Operators DevelopWhen Developers Operate and Operators Develop
When Developers Operate and Operators DevelopAdrian 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 OSCONAdrian 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 YorkAdrian Cockcroft
 
Innovation and Architecture
Innovation and ArchitectureInnovation and Architecture
Innovation and ArchitectureAdrian Cockcroft
 
Microservices Workshop - Craft Conference
Microservices Workshop - Craft ConferenceMicroservices Workshop - Craft Conference
Microservices Workshop - Craft ConferenceAdrian 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 TradeC4Media
 
Monitoring Challenges - Monitorama 2016 - Monitoringless
Monitoring Challenges - Monitorama 2016 - MonitoringlessMonitoring Challenges - Monitorama 2016 - Monitoringless
Monitoring Challenges - Monitorama 2016 - MonitoringlessAdrian Cockcroft
 
MicroServices at Netflix - challenges of scale
MicroServices at Netflix - challenges of scaleMicroServices at Netflix - challenges of scale
MicroServices at Netflix - challenges of scaleSudhir Tonse
 
Microservices Workshop All Topics Deck 2016
Microservices Workshop All Topics Deck 2016Microservices Workshop All Topics Deck 2016
Microservices Workshop All Topics Deck 2016Adrian Cockcroft
 
Evolution of Microservices - Craft Conference
Evolution of Microservices - Craft ConferenceEvolution of Microservices - Craft Conference
Evolution of Microservices - Craft ConferenceAdrian 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 MicroservicesAdrian Cockcroft
 

Destaque (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
 

Semelhante a Links, forms and unicorns

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 HydraMarkus 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 TitaniumJeroen 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 ArchitectureTom 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 WebTrotter Cashion
 
Couchbase presentation - by Patrick Heneise
Couchbase presentation - by Patrick HeneiseCouchbase presentation - by Patrick Heneise
Couchbase presentation - by Patrick Heneiseitnig
 
CSS3 Transforms Transitions and Animations
CSS3 Transforms Transitions and AnimationsCSS3 Transforms Transitions and Animations
CSS3 Transforms Transitions and AnimationsInayaili 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 SchnittstellenversionierungOPEN KNOWLEDGE GmbH
 
Idiomatic spock
Idiomatic spockIdiomatic spock
Idiomatic spockGR8Conf
 
Forbes MongoNYC 2011
Forbes MongoNYC 2011Forbes MongoNYC 2011
Forbes MongoNYC 2011djdunlop
 
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’élastiqueNicolas 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 webclkao
 
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 learnedMarcinStachniuk
 

Semelhante a 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
 

Último

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 

Último (20)

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 

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