SlideShare une entreprise Scribd logo
1  sur  39
REST – Beyond the hype
Who am I?
• Twitter: @darrel_miller
• http://www.bizcoder.com/
Solve API Problems Fast
Objectives
• Very brief history of REST
• Consider the alternatives
• The rise and fall of Pop REST
• The lies you have been told about REST
• Just the facts
• Open question period
You will get more from this if it is interactive, so ask questions,
challenge my assertions.
REST
What is it and where did it come from?
REST describes the architectural style of the Web
http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm
“Most of REST’s constraints are focused on
preserving independent evolvability over time,
which is only measurable on the scale of years.”
• How many users do you have? 10, 100, 10000
• How many different client applications do you have?
• Can you force updates on your users?
• Do you even control the clients?
What are the alternatives?
• Distributed Objects
• Event Based Integration
• RPC
Why not SOAP?
• Tooling made SOAP based systems fragile
• XML got blamed for people’s poor use of it
• Tooling forced SOAP to be implemented as RPC
The birth of Pop REST
• The craving for prescriptive guidance
• Web API Frameworks
• API Management vendors
Programmable Web
http://apievangelist.com/2014/04/15/what-are-some-good-examples-of-hypermedia-apis/
FoxyCart
A hypermedia example from the world of commerce, providing an example that fits nicely into the
API economy.
FamilySearch
An interesting approach to using hypermedia APIs for discovering and managing your family
history.
Huddle
An enteprise example of hypermdia APIs from the content collaboration platform huddle.
Amazon AppStream REST API
The Amazon AppStream web service provides APIs you can call to manage applications hosted on
Amazon AppStream and to manage client sessions connecting to those applications.
Clarify
Clarify is a self-service API that allows you to make your audio and video files actionable via search
and extracted keywords and topics.
Lync Web Developer
Microsoft’s Unified Communications Web API (UCWA) is the Next Generation Platform for Mobile
and Web Development.
PayPal REST API
One of the key features of the PayPal REST API is HATEOAS (Hypertext As The Engine Of Application
State).
VerticalResponse
VerticalResponse's API generally follows the REST model, based on the principles behind HTTP.
Lies you are being told about REST
“Your URLs should be RESTful”
• http://example.org/customer/10
• http://example.org/customer?id=10
• http://example.org/customer/10/edit
• http://example.org/customer/10/close
• http://example.org/9E9AD8EC-B4F5-4000-A74F-1F6CF99C5DDA
RFC 7320
URI Design and Ownership
“Expose your entities as resources"
• Name the resource
• http://example.org/order/23
• http://example.org/order/24
• http://example.org/users?name=bob
• http://example.org/users?name=bill
• http://example.org/location?lat=34&long=23
RFC 3986
RFC 2396
Entity free resources
• http://example.org/dashboard
• http://example.org/printer
• http://example.org/barcodeprocessor
• http://example.org/invoice/32/status
• http://example.org/searchform
• http://example.org/calculator
"instead of trying to figure out what a resource is, think of it in
terms of what it does." Leonard Richardson
Processing Resources
https://tools.ietf.org/html/rfc7231#section-4.3.3
“GET/PUT/POST/DELETE == CRUD”
• POST is not necessarily create
• PUT might be create or update
• DELETE doesn’t have to physically delete
• What about PATCH, HEAD, OPTIONS, TRACE ?
CRUD is a uniform way of exposing data
REST is intended to expose an application workflow.
“A REST API is for exposing your data on the web”
Patterns of Enterprise Architecture
Martin Fowler
“REST has no contracts just return
application/json and/or application/xml”
{} </>
GET /some-mystery-resource
=>
200 OK
Content-Type: application/xml
<ivik>
<spartun gecka="59" gasko="0"/>
<spartun gecka ="13" gasko ="1"/>
<spartun gecka ="17" gasko ="30"/>
<spartun gecka ="8" gasko ="365"/>
<spartun gecka ="3" gasko ="65535"/>
</ivik >
Let’s talk about contracts
GET /some-mystery-resource
=>
200 OK
Content-Type: application/vnd.acme.cache-stats+xml
<ivik>
<spartun gecka="59" gasko="0">
<spartun gecka="13" gasko="1">
<spartun gecka="17" gasko="30">
<spartun gecka="8" gasko="365">
<spartun gecka="3" gasko="65535">
</ivik>
http://www.iana.org/assignments/media-types/media-types.xhtml
GET /some-mystery-resource
=>
200 OK
Content-Type: application/vnd.acme.cache-stats+xml
<cacheStats>
<cacheMaxAge percent="59" daysUpperLimit="0">
<cacheMaxAge percent="13" daysUpperLimit="1">
<cacheMaxAge percent="17" daysUpperLimit="30">
<cacheMaxAge percent="8" daysUpperLimit="365">
<cacheMaxAge percent="3" daysUpperLimit="65535">
</cacheStats>
GET /some-mystery-resource
200 OK
Content-Type: application/data-series+xml
<series xAxisType="range"
yAxisType="percent"
title="% of requests with their max-age value in days">
<dataPoint yValue="59" xLowerValue="0" xUpperValue="0">
<dataPoint yValue="13" xLowerValue="0" xUpperValue="1">
<dataPoint yValue="17" xLowerValue="1" xUpperValue="30">
<dataPoint yValue="8" xLowerValue="30" xUpperValue="365">
<dataPoint yValue="3" xLowerValue="365" xUpperValue="65535">
</series>
Other media types that support hypermedia
application/xhtml+xml
application/hal+json
application/vnd.collection+json
application/vnd.siren+json
application/ld+json
application/rdf+xml
application/home+json
application/http-problem+json
application/atom+xml
application/activity+xml
text/uri-list
“Add metadata to be self-descriptive”
<ivik>
<metadata>
<Description>Max Age caching statistics</Description>
<Row Name =“spartun” Description=“data point”/>
<Property Name=“gecka” Type=“int” Descripton=“percentage”/>
<Property Name=“gasko” Type=“int” Descripton=“max age”/>
</metadata>
<spartun gecka="59" gasko="0"/>
<spartun gecka ="13" gasko ="1"/>
<spartun gecka ="17" gasko ="30"/>
<spartun gecka ="8" gasko ="365"/>
<spartun gecka ="3" gasko ="65535"/>
</ivik >
“Serializing DTOs is the best way to return data”
“A REST API should never have “typed” resources that are
significant to the client.”
“The only types that are significant to a client are the current
representation’s media type and standardized relation names.”
Get /Customer/10
=>
200 OK
Content-Type: application/json
{
“name” : “Acme Inc.”,
“street” : “87 Fortune way”,
“city” : “Winnipeg”,
“postalCode” : “T4R 2Y5”
}
“Design your URIs first”
• Design by URI tends to force your resource design into a hierarchy
• Can be constrained by the routing capabilities of your framework
• Discourages the creation of resources that don’t map directly to other
implementation concepts
• Focus more on structural relationships between resource rather than
workflow relationships.
Home
Speakers
Days
Topics
Sessions Session
Topic
Speaker
AllSpeakers
AllTopics
AllDays
TopicById
SessionsByDay
SpeakerById
SessionsById
SpeakersByTopic
SessionsByTopic
SessionsBySpeaker
Reviews
ReviewsBySession
ReviewsBy
Speaker
SessionsByKeyword
SpeakersByName
Conference Hypermedia API
“Adding hypermedia to your representations is
inefficient”
• Caching is critical
• Allows correct granularity of resources
• The additional costs of providing hypermedia are far outweighed by
its benefits
“You must document the URIs your API
exposes”
Absolutely need - Media types specifications, link relation
specifications, HTTP specification and root URL.
Including URIs in documentation is dangerous for RESTful systems.
Same for return types, error codes.
“You need to build a client SDK for your API”
• http://trafficandweather.io/posts/2013/10/20/episode-18-this-will-
be-way-easier
• SDKs can be a crutch for a poorly designed API
• SDKs are expensive to maintain
• SDKs can constrain deployment of new features
The problem with client libraries
PhotoSearchOptions options = new PhotoSearchOptions();
options.Tags = "blue,sky";
PhotoCollection photos = flickr.PhotosSearch(options);
So many lies, what is the truth
• Client/Server
• Stateless
• Caching
• Uniform Interface
• Layered
• Code on Demand
Questions

Contenu connexe

Tendances

Securing Web Applications with Token Authentication
Securing Web Applications with Token AuthenticationSecuring Web Applications with Token Authentication
Securing Web Applications with Token AuthenticationStormpath
 
Rapid API Development with LoopBack/StrongLoop
Rapid API Development with LoopBack/StrongLoopRapid API Development with LoopBack/StrongLoop
Rapid API Development with LoopBack/StrongLoopRaymond Camden
 
Web crawler with seo analysis
Web crawler with seo analysis Web crawler with seo analysis
Web crawler with seo analysis Vikram Parmar
 
Working with LoopBack Models
Working with LoopBack ModelsWorking with LoopBack Models
Working with LoopBack ModelsRaymond Feng
 
REST Architecture with use case and example
REST Architecture with use case and exampleREST Architecture with use case and example
REST Architecture with use case and exampleShailesh singh
 
APIs and Linked Data: A match made in Heaven
APIs and Linked Data: A match made in HeavenAPIs and Linked Data: A match made in Heaven
APIs and Linked Data: A match made in HeavenMichael Petychakis
 
Browser Security 101
Browser Security 101 Browser Security 101
Browser Security 101 Stormpath
 
Protecting Your APIs Against Attack & Hijack
Protecting Your APIs Against Attack & Hijack Protecting Your APIs Against Attack & Hijack
Protecting Your APIs Against Attack & Hijack CA API Management
 
Harnessing Free Content with Web Service APIs
Harnessing Free Content with Web Service APIsHarnessing Free Content with Web Service APIs
Harnessing Free Content with Web Service APIsALATechSource
 
Usergrid Overview
Usergrid OverviewUsergrid Overview
Usergrid Overviewusergrid
 
Picking the Right Node.js Framework for Your Use Case
Picking the Right Node.js Framework for Your Use CasePicking the Right Node.js Framework for Your Use Case
Picking the Right Node.js Framework for Your Use CaseJimmy Guerrero
 
SMART CRAWLER: A TWO-STAGE CRAWLER FOR EFFICIENTLY HARVESTING DEEP-WEB INTERF...
SMART CRAWLER: A TWO-STAGE CRAWLER FOR EFFICIENTLY HARVESTING DEEP-WEB INTERF...SMART CRAWLER: A TWO-STAGE CRAWLER FOR EFFICIENTLY HARVESTING DEEP-WEB INTERF...
SMART CRAWLER: A TWO-STAGE CRAWLER FOR EFFICIENTLY HARVESTING DEEP-WEB INTERF...CloudTechnologies
 
Secure Web Services
Secure Web ServicesSecure Web Services
Secure Web ServicesRob Daigneau
 
Hydra: A Vocabulary for Hypermedia-Driven Web APIs
Hydra: A Vocabulary for Hypermedia-Driven Web APIsHydra: A Vocabulary for Hypermedia-Driven Web APIs
Hydra: A Vocabulary for Hypermedia-Driven Web APIsMarkus Lanthaler
 

Tendances (20)

Securing Web Applications with Token Authentication
Securing Web Applications with Token AuthenticationSecuring Web Applications with Token Authentication
Securing Web Applications with Token Authentication
 
Rapid API Development with LoopBack/StrongLoop
Rapid API Development with LoopBack/StrongLoopRapid API Development with LoopBack/StrongLoop
Rapid API Development with LoopBack/StrongLoop
 
Web crawler with seo analysis
Web crawler with seo analysis Web crawler with seo analysis
Web crawler with seo analysis
 
Working with LoopBack Models
Working with LoopBack ModelsWorking with LoopBack Models
Working with LoopBack Models
 
REST Architecture with use case and example
REST Architecture with use case and exampleREST Architecture with use case and example
REST Architecture with use case and example
 
APIs and Linked Data: A match made in Heaven
APIs and Linked Data: A match made in HeavenAPIs and Linked Data: A match made in Heaven
APIs and Linked Data: A match made in Heaven
 
Browser Security 101
Browser Security 101 Browser Security 101
Browser Security 101
 
Protecting Your APIs Against Attack & Hijack
Protecting Your APIs Against Attack & Hijack Protecting Your APIs Against Attack & Hijack
Protecting Your APIs Against Attack & Hijack
 
Harnessing Free Content with Web Service APIs
Harnessing Free Content with Web Service APIsHarnessing Free Content with Web Service APIs
Harnessing Free Content with Web Service APIs
 
Library hacks
Library hacksLibrary hacks
Library hacks
 
Usergrid Overview
Usergrid OverviewUsergrid Overview
Usergrid Overview
 
Picking the Right Node.js Framework for Your Use Case
Picking the Right Node.js Framework for Your Use CasePicking the Right Node.js Framework for Your Use Case
Picking the Right Node.js Framework for Your Use Case
 
Web crawler
Web crawlerWeb crawler
Web crawler
 
Rest and Rails
Rest and RailsRest and Rails
Rest and Rails
 
SMART CRAWLER: A TWO-STAGE CRAWLER FOR EFFICIENTLY HARVESTING DEEP-WEB INTERF...
SMART CRAWLER: A TWO-STAGE CRAWLER FOR EFFICIENTLY HARVESTING DEEP-WEB INTERF...SMART CRAWLER: A TWO-STAGE CRAWLER FOR EFFICIENTLY HARVESTING DEEP-WEB INTERF...
SMART CRAWLER: A TWO-STAGE CRAWLER FOR EFFICIENTLY HARVESTING DEEP-WEB INTERF...
 
Secure Web Services
Secure Web ServicesSecure Web Services
Secure Web Services
 
Starwest 2008
Starwest 2008Starwest 2008
Starwest 2008
 
Rest in Rails
Rest in RailsRest in Rails
Rest in Rails
 
Hydra: A Vocabulary for Hypermedia-Driven Web APIs
Hydra: A Vocabulary for Hypermedia-Driven Web APIsHydra: A Vocabulary for Hypermedia-Driven Web APIs
Hydra: A Vocabulary for Hypermedia-Driven Web APIs
 
Smart Crawler
Smart CrawlerSmart Crawler
Smart Crawler
 

En vedette

Crafting Evolvable Api Responses
Crafting Evolvable Api ResponsesCrafting Evolvable Api Responses
Crafting Evolvable Api Responsesdarrelmiller71
 
Unit 4. nervous system
Unit 4. nervous systemUnit 4. nervous system
Unit 4. nervous systemMercheClemente
 
Hypermedia As The Evader Of App Stores
Hypermedia As The Evader Of App StoresHypermedia As The Evader Of App Stores
Hypermedia As The Evader Of App Storesdarrelmiller71
 
Prairie DevCon 2015 - Crafting Evolvable API Responses
Prairie DevCon 2015 - Crafting Evolvable API ResponsesPrairie DevCon 2015 - Crafting Evolvable API Responses
Prairie DevCon 2015 - Crafting Evolvable API Responsesdarrelmiller71
 
Consuming REST APIs for all interpretations of REST
Consuming REST APIs for all interpretations of RESTConsuming REST APIs for all interpretations of REST
Consuming REST APIs for all interpretations of RESTdarrelmiller71
 
Unit 4. locomotor system
Unit 4. locomotor systemUnit 4. locomotor system
Unit 4. locomotor systemMercheClemente
 
Unit 4. nervous system
Unit 4. nervous systemUnit 4. nervous system
Unit 4. nervous systemMercheClemente
 

En vedette (7)

Crafting Evolvable Api Responses
Crafting Evolvable Api ResponsesCrafting Evolvable Api Responses
Crafting Evolvable Api Responses
 
Unit 4. nervous system
Unit 4. nervous systemUnit 4. nervous system
Unit 4. nervous system
 
Hypermedia As The Evader Of App Stores
Hypermedia As The Evader Of App StoresHypermedia As The Evader Of App Stores
Hypermedia As The Evader Of App Stores
 
Prairie DevCon 2015 - Crafting Evolvable API Responses
Prairie DevCon 2015 - Crafting Evolvable API ResponsesPrairie DevCon 2015 - Crafting Evolvable API Responses
Prairie DevCon 2015 - Crafting Evolvable API Responses
 
Consuming REST APIs for all interpretations of REST
Consuming REST APIs for all interpretations of RESTConsuming REST APIs for all interpretations of REST
Consuming REST APIs for all interpretations of REST
 
Unit 4. locomotor system
Unit 4. locomotor systemUnit 4. locomotor system
Unit 4. locomotor system
 
Unit 4. nervous system
Unit 4. nervous systemUnit 4. nervous system
Unit 4. nervous system
 

Similaire à Lies you have been told about REST

APIs, Web Services, and Mashups: What they are and how they can be used
APIs, Web Services, and Mashups: What they are and how they can be usedAPIs, Web Services, and Mashups: What they are and how they can be used
APIs, Web Services, and Mashups: What they are and how they can be usedsnackeru
 
Building Tomorrow's Web Services
Building Tomorrow's Web ServicesBuilding Tomorrow's Web Services
Building Tomorrow's Web ServicesPat Cappelaere
 
Integrate MongoDB & SQL data with a single REST API
Integrate MongoDB & SQL data with a single REST APIIntegrate MongoDB & SQL data with a single REST API
Integrate MongoDB & SQL data with a single REST APIEspresso Logic
 
Innovate2014 Better Integrations Through Open Interfaces
Innovate2014 Better Integrations Through Open InterfacesInnovate2014 Better Integrations Through Open Interfaces
Innovate2014 Better Integrations Through Open InterfacesSteve Speicher
 
Hypermedia: The Missing Element to Building Adaptable Web APIs in Rails
Hypermedia: The Missing Element to Building Adaptable Web APIs in RailsHypermedia: The Missing Element to Building Adaptable Web APIs in Rails
Hypermedia: The Missing Element to Building Adaptable Web APIs in RailsToru Kawamura
 
REST and ASP.NET Web API (Milan)
REST and ASP.NET Web API (Milan)REST and ASP.NET Web API (Milan)
REST and ASP.NET Web API (Milan)Jef Claes
 
Hypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix EngineeringHypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix EngineeringVladimir Tsukur
 
Introduction to the Web API
Introduction to the Web APIIntroduction to the Web API
Introduction to the Web APIBrad Genereaux
 
Web of things introduction
Web of things introductionWeb of things introduction
Web of things introduction承翰 蔡
 
What is API - Understanding API Simplified
What is API - Understanding API SimplifiedWhat is API - Understanding API Simplified
What is API - Understanding API SimplifiedJubin Aghara
 
REST vs WS-*: Myths Facts and Lies
REST vs WS-*: Myths Facts and LiesREST vs WS-*: Myths Facts and Lies
REST vs WS-*: Myths Facts and LiesPaul Fremantle
 
Together Cheerfully to Walk with Hypermedia
Together Cheerfully to Walk with HypermediaTogether Cheerfully to Walk with Hypermedia
Together Cheerfully to Walk with HypermediaVladimir Tsukur
 
API Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIsAPI Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIsTom Johnson
 
Designing RESTful APIs
Designing RESTful APIsDesigning RESTful APIs
Designing RESTful APIsanandology
 
Building Software Backend (Web API)
Building Software Backend (Web API)Building Software Backend (Web API)
Building Software Backend (Web API)Alexander Goida
 

Similaire à Lies you have been told about REST (20)

Modified REST Presentation
Modified REST PresentationModified REST Presentation
Modified REST Presentation
 
APIs, Web Services, and Mashups: What they are and how they can be used
APIs, Web Services, and Mashups: What they are and how they can be usedAPIs, Web Services, and Mashups: What they are and how they can be used
APIs, Web Services, and Mashups: What they are and how they can be used
 
Building Tomorrow's Web Services
Building Tomorrow's Web ServicesBuilding Tomorrow's Web Services
Building Tomorrow's Web Services
 
Rest web services
Rest web servicesRest web services
Rest web services
 
Integrate MongoDB & SQL data with a single REST API
Integrate MongoDB & SQL data with a single REST APIIntegrate MongoDB & SQL data with a single REST API
Integrate MongoDB & SQL data with a single REST API
 
Innovate2014 Better Integrations Through Open Interfaces
Innovate2014 Better Integrations Through Open InterfacesInnovate2014 Better Integrations Through Open Interfaces
Innovate2014 Better Integrations Through Open Interfaces
 
Hypermedia: The Missing Element to Building Adaptable Web APIs in Rails
Hypermedia: The Missing Element to Building Adaptable Web APIs in RailsHypermedia: The Missing Element to Building Adaptable Web APIs in Rails
Hypermedia: The Missing Element to Building Adaptable Web APIs in Rails
 
Micro service architecture
Micro service architectureMicro service architecture
Micro service architecture
 
REST and ASP.NET Web API (Milan)
REST and ASP.NET Web API (Milan)REST and ASP.NET Web API (Milan)
REST and ASP.NET Web API (Milan)
 
Hypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix EngineeringHypermedia APIs and HATEOAS / Wix Engineering
Hypermedia APIs and HATEOAS / Wix Engineering
 
Introduction to the Web API
Introduction to the Web APIIntroduction to the Web API
Introduction to the Web API
 
Web of things introduction
Web of things introductionWeb of things introduction
Web of things introduction
 
Why do you need REST
Why do you need RESTWhy do you need REST
Why do you need REST
 
What is API - Understanding API Simplified
What is API - Understanding API SimplifiedWhat is API - Understanding API Simplified
What is API - Understanding API Simplified
 
REST vs WS-*: Myths Facts and Lies
REST vs WS-*: Myths Facts and LiesREST vs WS-*: Myths Facts and Lies
REST vs WS-*: Myths Facts and Lies
 
Together Cheerfully to Walk with Hypermedia
Together Cheerfully to Walk with HypermediaTogether Cheerfully to Walk with Hypermedia
Together Cheerfully to Walk with Hypermedia
 
API Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIsAPI Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIs
 
Designing RESTful APIs
Designing RESTful APIsDesigning RESTful APIs
Designing RESTful APIs
 
Web Services
Web ServicesWeb Services
Web Services
 
Building Software Backend (Web API)
Building Software Backend (Web API)Building Software Backend (Web API)
Building Software Backend (Web API)
 

Dernier

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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
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
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
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 Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 

Dernier (20)

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
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
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 Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
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...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 

Lies you have been told about REST

  • 1. REST – Beyond the hype
  • 2. Who am I? • Twitter: @darrel_miller • http://www.bizcoder.com/ Solve API Problems Fast
  • 3.
  • 4. Objectives • Very brief history of REST • Consider the alternatives • The rise and fall of Pop REST • The lies you have been told about REST • Just the facts • Open question period You will get more from this if it is interactive, so ask questions, challenge my assertions.
  • 5. REST What is it and where did it come from? REST describes the architectural style of the Web http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm
  • 6. “Most of REST’s constraints are focused on preserving independent evolvability over time, which is only measurable on the scale of years.”
  • 7. • How many users do you have? 10, 100, 10000 • How many different client applications do you have? • Can you force updates on your users? • Do you even control the clients?
  • 8. What are the alternatives? • Distributed Objects • Event Based Integration • RPC
  • 9. Why not SOAP? • Tooling made SOAP based systems fragile • XML got blamed for people’s poor use of it • Tooling forced SOAP to be implemented as RPC
  • 10. The birth of Pop REST • The craving for prescriptive guidance • Web API Frameworks • API Management vendors
  • 12. http://apievangelist.com/2014/04/15/what-are-some-good-examples-of-hypermedia-apis/ FoxyCart A hypermedia example from the world of commerce, providing an example that fits nicely into the API economy. FamilySearch An interesting approach to using hypermedia APIs for discovering and managing your family history. Huddle An enteprise example of hypermdia APIs from the content collaboration platform huddle. Amazon AppStream REST API The Amazon AppStream web service provides APIs you can call to manage applications hosted on Amazon AppStream and to manage client sessions connecting to those applications. Clarify Clarify is a self-service API that allows you to make your audio and video files actionable via search and extracted keywords and topics. Lync Web Developer Microsoft’s Unified Communications Web API (UCWA) is the Next Generation Platform for Mobile and Web Development. PayPal REST API One of the key features of the PayPal REST API is HATEOAS (Hypertext As The Engine Of Application State). VerticalResponse VerticalResponse's API generally follows the REST model, based on the principles behind HTTP.
  • 13. Lies you are being told about REST
  • 14. “Your URLs should be RESTful” • http://example.org/customer/10 • http://example.org/customer?id=10 • http://example.org/customer/10/edit • http://example.org/customer/10/close • http://example.org/9E9AD8EC-B4F5-4000-A74F-1F6CF99C5DDA
  • 15.
  • 16.
  • 17. RFC 7320 URI Design and Ownership
  • 18. “Expose your entities as resources" • Name the resource • http://example.org/order/23 • http://example.org/order/24 • http://example.org/users?name=bob • http://example.org/users?name=bill • http://example.org/location?lat=34&long=23 RFC 3986 RFC 2396
  • 19. Entity free resources • http://example.org/dashboard • http://example.org/printer • http://example.org/barcodeprocessor • http://example.org/invoice/32/status • http://example.org/searchform • http://example.org/calculator "instead of trying to figure out what a resource is, think of it in terms of what it does." Leonard Richardson
  • 21. “GET/PUT/POST/DELETE == CRUD” • POST is not necessarily create • PUT might be create or update • DELETE doesn’t have to physically delete • What about PATCH, HEAD, OPTIONS, TRACE ? CRUD is a uniform way of exposing data REST is intended to expose an application workflow.
  • 22. “A REST API is for exposing your data on the web” Patterns of Enterprise Architecture Martin Fowler
  • 23. “REST has no contracts just return application/json and/or application/xml” {} </>
  • 24. GET /some-mystery-resource => 200 OK Content-Type: application/xml <ivik> <spartun gecka="59" gasko="0"/> <spartun gecka ="13" gasko ="1"/> <spartun gecka ="17" gasko ="30"/> <spartun gecka ="8" gasko ="365"/> <spartun gecka ="3" gasko ="65535"/> </ivik > Let’s talk about contracts
  • 25. GET /some-mystery-resource => 200 OK Content-Type: application/vnd.acme.cache-stats+xml <ivik> <spartun gecka="59" gasko="0"> <spartun gecka="13" gasko="1"> <spartun gecka="17" gasko="30"> <spartun gecka="8" gasko="365"> <spartun gecka="3" gasko="65535"> </ivik> http://www.iana.org/assignments/media-types/media-types.xhtml
  • 26. GET /some-mystery-resource => 200 OK Content-Type: application/vnd.acme.cache-stats+xml <cacheStats> <cacheMaxAge percent="59" daysUpperLimit="0"> <cacheMaxAge percent="13" daysUpperLimit="1"> <cacheMaxAge percent="17" daysUpperLimit="30"> <cacheMaxAge percent="8" daysUpperLimit="365"> <cacheMaxAge percent="3" daysUpperLimit="65535"> </cacheStats>
  • 27. GET /some-mystery-resource 200 OK Content-Type: application/data-series+xml <series xAxisType="range" yAxisType="percent" title="% of requests with their max-age value in days"> <dataPoint yValue="59" xLowerValue="0" xUpperValue="0"> <dataPoint yValue="13" xLowerValue="0" xUpperValue="1"> <dataPoint yValue="17" xLowerValue="1" xUpperValue="30"> <dataPoint yValue="8" xLowerValue="30" xUpperValue="365"> <dataPoint yValue="3" xLowerValue="365" xUpperValue="65535"> </series>
  • 28. Other media types that support hypermedia application/xhtml+xml application/hal+json application/vnd.collection+json application/vnd.siren+json application/ld+json application/rdf+xml application/home+json application/http-problem+json application/atom+xml application/activity+xml text/uri-list
  • 29. “Add metadata to be self-descriptive” <ivik> <metadata> <Description>Max Age caching statistics</Description> <Row Name =“spartun” Description=“data point”/> <Property Name=“gecka” Type=“int” Descripton=“percentage”/> <Property Name=“gasko” Type=“int” Descripton=“max age”/> </metadata> <spartun gecka="59" gasko="0"/> <spartun gecka ="13" gasko ="1"/> <spartun gecka ="17" gasko ="30"/> <spartun gecka ="8" gasko ="365"/> <spartun gecka ="3" gasko ="65535"/> </ivik >
  • 30. “Serializing DTOs is the best way to return data” “A REST API should never have “typed” resources that are significant to the client.” “The only types that are significant to a client are the current representation’s media type and standardized relation names.”
  • 31. Get /Customer/10 => 200 OK Content-Type: application/json { “name” : “Acme Inc.”, “street” : “87 Fortune way”, “city” : “Winnipeg”, “postalCode” : “T4R 2Y5” }
  • 32. “Design your URIs first” • Design by URI tends to force your resource design into a hierarchy • Can be constrained by the routing capabilities of your framework • Discourages the creation of resources that don’t map directly to other implementation concepts • Focus more on structural relationships between resource rather than workflow relationships.
  • 34. “Adding hypermedia to your representations is inefficient” • Caching is critical • Allows correct granularity of resources • The additional costs of providing hypermedia are far outweighed by its benefits
  • 35. “You must document the URIs your API exposes” Absolutely need - Media types specifications, link relation specifications, HTTP specification and root URL. Including URIs in documentation is dangerous for RESTful systems. Same for return types, error codes.
  • 36. “You need to build a client SDK for your API” • http://trafficandweather.io/posts/2013/10/20/episode-18-this-will- be-way-easier • SDKs can be a crutch for a poorly designed API • SDKs are expensive to maintain • SDKs can constrain deployment of new features
  • 37. The problem with client libraries PhotoSearchOptions options = new PhotoSearchOptions(); options.Tags = "blue,sky"; PhotoCollection photos = flickr.PhotosSearch(options);
  • 38. So many lies, what is the truth • Client/Server • Stateless • Caching • Uniform Interface • Layered • Code on Demand

Notes de l'éditeur

  1. - Developer advocate for Runscope. - Cloud based solutions for API performance monitoring Microsoft MVP Book
  2. Considered doing the standard REST talk. This is how you can do it. But there are many places where they will tell you that. Many of them are wrong. I decided to take a more confrontational approach and tell you the lies you are being told about REST. Hopefully it will make the next few hours easier to stay awake and I’m hoping it will promote more interaction. We will have an open question period but ….
  3. Why should I care about REST? REST is style that can be applied to building distributed systems. Web APIs, Microservices. Business to business interactions, Mobile applications.
  4. Evolvability matters when there are many different participants in the distributed system under control by different release cycles. The REST constraints are all about reducing, focusing and controlling the coupling between clients and servers to make change easier to manage.
  5. Dist objs. – died with corba, web sphere EBI – Service Buses, big client requirements. RPC – SOAP/ XML-RPC
  6. SOAP 1.0 (2000) mentioned using it for RPC. By Dec 2001 it was fixed.
  7. REST was touted as easier than SOAP, testable from the browser, the next silver bullet. More lightweight. “no contracts”.
  8. Now almost 13,000 APIs listed. To this date there are only a handful of public APIs that support hypermedia.
  9. I’m taking this more confrontational approach because I’m hoping to provoke conversation. This mis-information is everywhere. Even starting to appear in “best practices” articles. Credibility.
  10. Which of these are RESTful? The question makes no sense. An identifier is just that. It can’t be restful or not restful. How you are able to interact with that resource determines whether the URI identifies a RESTful resource. Sadly, it’s an uphill battle. On SO alone there are 358 questions about RESTful urls.
  11. Web Frameworks like rails invented this convention so that they could provide facilities to make it easy to implement REST based systems. But somewhere along the way, someone decided that this convention was definitively what REST was.
  12. There is nothing wrong with a web framework defining conventions for exposing resources. However, claiming that this is the definition of REST is like Facebook declaring that Facebook is the Web. OData
  13. Specific APIs can define conventions, but shouldn’t be standardized Hurts re-use
  14. Resources are more like object instances than classes.
  15. Content-Type is supposed to provide the information I need to find out how to interpret the document
  16. With this content-type, as a client developer, I can go to IANA, find the spec, understand the mean and write code to process it.
  17. Obviously human readable makes sense, but just because we understand it, that isn’t enough. REST has a notion of self-descriptive. We don’t want to depend on the client having to be able to understand/recognize/parse the URL to be able to interpret the meaning of the response. The problem with the media type as define here, is that it is extremely specific. Not very re-usable. Too much effort to write a spec and register it. Consider for a moment what a client might want to do with this data.
  18. If all we want the client to do is be able to view a graph of the data, or do some simple statistical analysis, then maybe a more generic media type is suitable.
  19. Self-descriptive means that the message declares everything that the client application needs to understand in order to process the message. Adding metadata to an application/xml response just moves the lack of understanding of the content, to the lack of understanding of the metadata. Application/xml and application/json have no semantics
  20. DTO’s as introduced by Fowler we useful for RPC based distributed systems, however REST uses media types as the contracts for interacting with other systems over the wire. Media types are a more controlled environment that take a far more tolerant approach to versioning and are globally discoverable
  21. DTO generally get returned in application/xml and application/json formats so are not self-descriptive. This means the client needs to know what content is coming from which URI. Creating a media type for every DTO is a crazy proposition. Windows Explorer example.
  22. No URIs were harmed in the making of this design.
  23. Link bloat --- compression / relative URIs / templates
  24. Is this accessing the REST api, or the SOAP api? Which line of code makes a network request? What happens when PhotosSearch fail? Is it safe to retry? Was it an auth problem? Was it a versioning problem? What happens when Flickr add a new property to PhotoSearchOptions or PhotoCollection? New versions are all or nothing.