SlideShare uma empresa Scribd logo
1 de 53
Baixar para ler offline
THE GLORY OF REST
THEORY
Source: www.redorbit.com
WEB SERVICE
A web service is an abstraction layer, like an
operating system API or a programming
language library.
RPC-STYLE ARCHITECTURES
envelope full of data
HTTP and SOAP are envelope formats
RPC-Style service defines it's own vocabulary
RESTful WS share standard HTTP methods vocabulary
REST Uniform Interface
RESTful - different URIs for different values
RPC-style - URI (service endpoint) for something that can be
processed as a command
REST-RPC HYBRID ARCHITECTURES
Web service between the RESTful web
services and the purely RPC-style services
FEW REST-RPC EXAMPLES
The
The "REST"
Many other allegedly RESTful web services
Most web applications
del.icio.us API
Flickr web API
SOAP AS A COMPETITOR TO REST
The primary competitors to RESTful
architectures are RPC architectures, not
specific technologies like SOAP.
RICHARDSON MATURITY MODEL
Source: http://martinfowler.com
LEVEL 0 - THE SWAMP OF POX
HTTP POST for all interactions
LEVEL 1 - RESOURCES
Distinct URL per object
LEVEL 2 - HTTP VERBS
Rather than doing RPC style methods, we
leverage HTTP
LEVEL 3 - HYPERMEDIA CONTROLS
Self-describing API
SO WHAT IS THIS REST
THING?
REST simply dictates that a given resource have a unique
address.
You can interact with that address with standard HTTP verbs.
STATE AND
STATELESSNESS
TWO TYPES OF STATE:
1. application state - live on the client
2. resource state - live on the server
Resource state stays on the server and is only sent to the
client in the form of representations.
Application state stays on the client until it can be used to
create, modify, or delete a resource. Then it's sent to the
server as part of POST, PUT, or DELETE request, and
becomes resource state.
RESTful service is "stateless" if the server never stores any
application state.
This is where the name "Representational State Transfer"
comes from.
ETAGS
ETags are used to compare entities from the
same resource. By supplying an entity tag
value in a conditional request header.
RESOURCE-ORIENTED
BASICS
different audience
everything (interesting) thing represent as a resource
representation of resources
verbs, auxiliaries, complexity
THE GENERIC ROA PROCEDURE
1. Figure out the data set
2. Split the data set into resources
For each kind of resource:
3. Name the resources with URIs
4. Expose a subset of the uniform interface
5. Design the representation(s) accepted from the client
6. Design the representation(s) served to the client
7. Integrate this resource into existing resources, using hypermedia links
and forms
8. Consider the typical course of events: what’s supposed to happen?
Standard control flows like the Atom Publishing Protocol can help.
9. Consider error conditions: what might go wrong? Again, standard control
flows can help.
ADDRESSABILITY
REPRESENTATIONS SHOULD BE ADDRESSABLE
CONNECTEDNESS
UNIFORM INTERFACE
GET, PUT, AND DELETE
POST
HEAD AND OPTIONS
Retrieve a metadata-only representation: HTTP HEAD
Check which HTTP methods a particular resource
supports: HTTP OPTIONS
PUT VERSUS POST
OVERLOADING POST
The real information may be in the URI, the
HTTP headers, or the entity-body. However it
happens, an element of the RPC style has
crept into the service.
SAFETY AND
IDEMPOTENCE
When correctly used, GET and HEAD
requests are safe. GET, HEAD, PUT and
DELETE requests are idempotent.
URI DESING
URIs are supposed to designate resources, not
operations on the resources.
MethodMethod URI TemplateURI Template Equivalent RPCEquivalent RPC
OperationOperation
PUT users/{username} createUserAccount
GET users/{username} getUserAccount
PUT users/{username} updateUserAccount
DELETE users/{username} deleteUserAccount
GET users/{username}/profile getUserProfile
POST users/{username}/bookmarks createBookmark
PUT users/{username}/bookmarks/{id} updateBookmark
DELETE users/{username}/bookmarks/{id} deleteBookmark
GET users/{username}/bookmarks/{id} getBookmark
GET users/{username}/bookmarks?tag=
{tag}
getUserBookmarks
GET {username}?tag={tag} getUserPublicBookmarks
GET ?tag={tag} getPublicBookmarks
Use commas when the order of the items matters, as it
does in latitude and longitude: /earth/37.0,-95.2
Use semicolons when the order doesn’t matter: /color-
blends/red;blue
When designing URIs, use path variables to separate
elements of a hierarchy, or a path through a directed graph.
Use query variables only to suggest arguments being
plugged into an algorithm, or when the other two
techniques fail.
REPRESENTATIONS
Representations should be human-readable,
but computer-oriented
SERVICE VERSIONING
Even a well-connected service might need to
be versioned
SECURITY
HMAC
"Authorization: AWS " + AWSAccessKeyId+ ":" +
base64(hmac-sha1(VERB + "n" +
CONTENT-MD5 + "n" +
CONTENT-TYPE + "n" +
DATE + "n" +
CanonicalizedAmzHeaders + "n" +
CanonicalizedResource))
Authorization: AWS 44CF9590006BF252F707:jZNOcbfWmD/A/f3hSvVzXZjM2HU=
JSON OR XML
JSON
If all you want to pass around are atomic
values or lists or hashes of atomic values,
JSON has many of the advantages of XML: it’s
straightforwardly usable over the Internet,
supports a wide variety of applications, it’s
easy to write programs to process JSON, it
has few optional features, it’s human-legible
and reasonably clear, its design is formal and
concise, JSON documents are easy to create,
and it uses Unicode.
If you’re writing JavaScript in a web browser,
JSON is a natural fit. The XML APIs in the
browser are comparitively clumsy and the
natural mapping from JavaScript objects to
JSON eliminates the serialization issues that
arise if you’re careless with XML.
One line of argument for JSON over XML is
simplicity. If you mean it’s simpler to have a
single data interchange format instead of two,
that’s incontrovertibly the case. If you mean
JSON is intrinsically simpler than XML, well,
I’m not sure that’s so obvious. For bundles of
atomic values, it’s a little simpler. And the
JavaScript APIs are definitely simpler. But I’ve
seen attempts to represent mixed content in
JSON and simple they aren’t.
XML
XML deals remarkably well with the full
richness of unstructured data. I’m not worried
about the future of XML at all even if its death
is gleefully celebrated by a cadre of web API
designers.
I look forward to seeing what the JSON folks
do when they are asked to develop richer
APIs. When they want to exchange less well
strucured data, will they shoehorn it into
JSON? I see occasional mentions of a schema
language for JSON, will other languages
follow?
I predict there will come a day when someone
wants to federate JSON data across several
application domains. I wonder, when they
discover that the key "width" means different
things to different constituencies, will they
invent namespaces too?
JSON AND HYPERMEDIA
HAL Media Types
HAL and Links
HAL and Resources
HAL Embedded Resources
ERROR HANDLING
WHY STATUS CODES AREN’T ENOUGH?
A status code simply isn’t enough information most of the
time. Yes, you want to define standard status codes so that
your clients can perform reasonable branching, but you also
need a way to communicate details to the end-user, so that
they can log the information for themselves, display
information to their own end-users, and/or report it back to
you so you can do something to resolve the situation.
SOURCESRESTful Web Services
Microsoft REST Spec
Amazon's HMAC-SHA
HTTP Method Definitions
JSON and REST presentation
HAL Specification
THE END
Sławomir Chrobak /
Link to presentation:
@schrobak
http://schrobak.github.io/slides/tgor

Mais conteúdo relacionado

Mais procurados

Autoware: ROSを用いた一般道自動運転向けソフトウェアプラットフォーム
Autoware: ROSを用いた一般道自動運転向けソフトウェアプラットフォームAutoware: ROSを用いた一般道自動運転向けソフトウェアプラットフォーム
Autoware: ROSを用いた一般道自動運転向けソフトウェアプラットフォームTakuya Azumi
 
RCカーを用いた自動運転車両シミュレーション環境に関する研究
RCカーを用いた自動運転車両シミュレーション環境に関する研究RCカーを用いた自動運転車両シミュレーション環境に関する研究
RCカーを用いた自動運転車両シミュレーション環境に関する研究harmonylab
 
MÉTODOS DE AVALIAÇÃO DA USABILIDADE
MÉTODOS DE AVALIAÇÃO DA USABILIDADEMÉTODOS DE AVALIAÇÃO DA USABILIDADE
MÉTODOS DE AVALIAÇÃO DA USABILIDADEAndrea Dalforno
 
Grupo focal e Grupo Focal Virtual
Grupo focal e Grupo Focal VirtualGrupo focal e Grupo Focal Virtual
Grupo focal e Grupo Focal VirtualWalison Aparecido
 
Grafos - Uma abordagem divertida - Latinoware 2014
Grafos - Uma abordagem divertida - Latinoware 2014Grafos - Uma abordagem divertida - Latinoware 2014
Grafos - Uma abordagem divertida - Latinoware 2014Christiano Anderson
 
Treinamento de Scrum
Treinamento de ScrumTreinamento de Scrum
Treinamento de ScrumLuiz Duarte
 
NDC 2015. 한 그루 한 그루 심지 않아도 돼요. 생태학에 기반한 [야생의 땅: 듀랑고]의 절차적 생성 생태계
NDC 2015. 한 그루 한 그루 심지 않아도 돼요. 생태학에 기반한 [야생의 땅: 듀랑고]의 절차적 생성 생태계NDC 2015. 한 그루 한 그루 심지 않아도 돼요. 생태학에 기반한 [야생의 땅: 듀랑고]의 절차적 생성 생태계
NDC 2015. 한 그루 한 그루 심지 않아도 돼요. 생태학에 기반한 [야생의 땅: 듀랑고]의 절차적 생성 생태계Imseong Kang
 
опн, хпн, нг абдуллаева а.б
опн, хпн, нг абдуллаева а.бопн, хпн, нг абдуллаева а.б
опн, хпн, нг абдуллаева а.бmanap3
 
Apresentação sobre metodologia Scrum
Apresentação sobre metodologia ScrumApresentação sobre metodologia Scrum
Apresentação sobre metodologia ScrumIsaacBessa
 
Palestra Gamificação na Educação - Congresso Internacional do IESPES 2018
Palestra Gamificação na Educação - Congresso Internacional do IESPES 2018Palestra Gamificação na Educação - Congresso Internacional do IESPES 2018
Palestra Gamificação na Educação - Congresso Internacional do IESPES 2018Márcio Darlen Lopes Cavalcante
 
Scrum - Uma introdução a agilidade
Scrum - Uma introdução a agilidadeScrum - Uma introdução a agilidade
Scrum - Uma introdução a agilidadeThiago Boschese
 
Usabilidade heurística
Usabilidade heurísticaUsabilidade heurística
Usabilidade heurísticaOtavio Augusto
 
Hear no evil, see no evil, patch no evil: Or, how to monkey-patch safely.
Hear no evil, see no evil, patch no evil: Or, how to monkey-patch safely.Hear no evil, see no evil, patch no evil: Or, how to monkey-patch safely.
Hear no evil, see no evil, patch no evil: Or, how to monkey-patch safely.Graham Dumpleton
 

Mais procurados (20)

Palestra Agile Mindset | Ago-21
Palestra Agile Mindset | Ago-21Palestra Agile Mindset | Ago-21
Palestra Agile Mindset | Ago-21
 
Brainstormin
BrainstorminBrainstormin
Brainstormin
 
Autoware: ROSを用いた一般道自動運転向けソフトウェアプラットフォーム
Autoware: ROSを用いた一般道自動運転向けソフトウェアプラットフォームAutoware: ROSを用いた一般道自動運転向けソフトウェアプラットフォーム
Autoware: ROSを用いた一般道自動運転向けソフトウェアプラットフォーム
 
RCカーを用いた自動運転車両シミュレーション環境に関する研究
RCカーを用いた自動運転車両シミュレーション環境に関する研究RCカーを用いた自動運転車両シミュレーション環境に関する研究
RCカーを用いた自動運転車両シミュレーション環境に関する研究
 
MÉTODOS DE AVALIAÇÃO DA USABILIDADE
MÉTODOS DE AVALIAÇÃO DA USABILIDADEMÉTODOS DE AVALIAÇÃO DA USABILIDADE
MÉTODOS DE AVALIAÇÃO DA USABILIDADE
 
Grupo focal e Grupo Focal Virtual
Grupo focal e Grupo Focal VirtualGrupo focal e Grupo Focal Virtual
Grupo focal e Grupo Focal Virtual
 
Grafos - Uma abordagem divertida - Latinoware 2014
Grafos - Uma abordagem divertida - Latinoware 2014Grafos - Uma abordagem divertida - Latinoware 2014
Grafos - Uma abordagem divertida - Latinoware 2014
 
Treinamento de Scrum
Treinamento de ScrumTreinamento de Scrum
Treinamento de Scrum
 
Impressoras 3 D
Impressoras 3 DImpressoras 3 D
Impressoras 3 D
 
Scrum
ScrumScrum
Scrum
 
NDC 2015. 한 그루 한 그루 심지 않아도 돼요. 생태학에 기반한 [야생의 땅: 듀랑고]의 절차적 생성 생태계
NDC 2015. 한 그루 한 그루 심지 않아도 돼요. 생태학에 기반한 [야생의 땅: 듀랑고]의 절차적 생성 생태계NDC 2015. 한 그루 한 그루 심지 않아도 돼요. 생태학에 기반한 [야생의 땅: 듀랑고]의 절차적 생성 생태계
NDC 2015. 한 그루 한 그루 심지 않아도 돼요. 생태학에 기반한 [야생의 땅: 듀랑고]의 절차적 생성 생태계
 
O Método Kanban
O Método KanbanO Método Kanban
O Método Kanban
 
опн, хпн, нг абдуллаева а.б
опн, хпн, нг абдуллаева а.бопн, хпн, нг абдуллаева а.б
опн, хпн, нг абдуллаева а.б
 
Apresentação sobre metodologia Scrum
Apresentação sobre metodologia ScrumApresentação sobre metodologia Scrum
Apresentação sobre metodologia Scrum
 
Palestra Gamificação na Educação - Congresso Internacional do IESPES 2018
Palestra Gamificação na Educação - Congresso Internacional do IESPES 2018Palestra Gamificação na Educação - Congresso Internacional do IESPES 2018
Palestra Gamificação na Educação - Congresso Internacional do IESPES 2018
 
Scrum - Uma introdução a agilidade
Scrum - Uma introdução a agilidadeScrum - Uma introdução a agilidade
Scrum - Uma introdução a agilidade
 
Usabilidade heurística
Usabilidade heurísticaUsabilidade heurística
Usabilidade heurística
 
SLAM勉強会(PTAM)
SLAM勉強会(PTAM)SLAM勉強会(PTAM)
SLAM勉強会(PTAM)
 
Hear no evil, see no evil, patch no evil: Or, how to monkey-patch safely.
Hear no evil, see no evil, patch no evil: Or, how to monkey-patch safely.Hear no evil, see no evil, patch no evil: Or, how to monkey-patch safely.
Hear no evil, see no evil, patch no evil: Or, how to monkey-patch safely.
 
Agile SCRUM
Agile SCRUMAgile SCRUM
Agile SCRUM
 

Semelhante a The Glory of Rest

Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Jackson F. de A. Mafra
 
Automating the Use of Web APIs through Lightweight Semantics
Automating the Use of Web APIs through Lightweight SemanticsAutomating the Use of Web APIs through Lightweight Semantics
Automating the Use of Web APIs through Lightweight Semanticsmmaleshkova
 
Open Calais
Open CalaisOpen Calais
Open Calaisymark
 
Document Databases & RavenDB
Document Databases & RavenDBDocument Databases & RavenDB
Document Databases & RavenDBBrian Ritchie
 
SemanticWeb Nuts 'n Bolts
SemanticWeb Nuts 'n BoltsSemanticWeb Nuts 'n Bolts
SemanticWeb Nuts 'n BoltsRinke Hoekstra
 
Web services for developer
Web services for developerWeb services for developer
Web services for developerRafiq Ahmed
 
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRISThe glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRISGeert Pante
 
Building social and RESTful frameworks
Building social and RESTful frameworksBuilding social and RESTful frameworks
Building social and RESTful frameworksbrendonschwartz
 
Restful web services by Sreeni Inturi
Restful web services by Sreeni InturiRestful web services by Sreeni Inturi
Restful web services by Sreeni InturiSreeni I
 
Paul Fremantle Restful SOA Registry
Paul Fremantle Restful SOA RegistryPaul Fremantle Restful SOA Registry
Paul Fremantle Restful SOA Registrydeimos
 
RESTful Web APIs – Mike Amundsen, Principal API Architect, Layer 7
RESTful Web APIs – Mike Amundsen, Principal API Architect, Layer 7RESTful Web APIs – Mike Amundsen, Principal API Architect, Layer 7
RESTful Web APIs – Mike Amundsen, Principal API Architect, Layer 7CA API Management
 

Semelhante a The Glory of Rest (20)

Rest web service
Rest web serviceRest web service
Rest web service
 
Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015
 
Automating the Use of Web APIs through Lightweight Semantics
Automating the Use of Web APIs through Lightweight SemanticsAutomating the Use of Web APIs through Lightweight Semantics
Automating the Use of Web APIs through Lightweight Semantics
 
SCDJWS 6. REST JAX-P
SCDJWS 6. REST  JAX-PSCDJWS 6. REST  JAX-P
SCDJWS 6. REST JAX-P
 
Unit 2
Unit 2Unit 2
Unit 2
 
Advanced soa and web services
Advanced soa and web servicesAdvanced soa and web services
Advanced soa and web services
 
RIA Data and Security, 2007
RIA Data and Security, 2007RIA Data and Security, 2007
RIA Data and Security, 2007
 
Open Calais
Open CalaisOpen Calais
Open Calais
 
Document Databases & RavenDB
Document Databases & RavenDBDocument Databases & RavenDB
Document Databases & RavenDB
 
SemanticWeb Nuts 'n Bolts
SemanticWeb Nuts 'n BoltsSemanticWeb Nuts 'n Bolts
SemanticWeb Nuts 'n Bolts
 
SFDC REST API
SFDC REST APISFDC REST API
SFDC REST API
 
Web services for developer
Web services for developerWeb services for developer
Web services for developer
 
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRISThe glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
The glory of REST in Java: Spring HATEOAS, RAML, Temenos IRIS
 
Building social and RESTful frameworks
Building social and RESTful frameworksBuilding social and RESTful frameworks
Building social and RESTful frameworks
 
Restful web services by Sreeni Inturi
Restful web services by Sreeni InturiRestful web services by Sreeni Inturi
Restful web services by Sreeni Inturi
 
Paul Fremantle Restful SOA Registry
Paul Fremantle Restful SOA RegistryPaul Fremantle Restful SOA Registry
Paul Fremantle Restful SOA Registry
 
RESTful Web APIs – Mike Amundsen, Principal API Architect, Layer 7
RESTful Web APIs – Mike Amundsen, Principal API Architect, Layer 7RESTful Web APIs – Mike Amundsen, Principal API Architect, Layer 7
RESTful Web APIs – Mike Amundsen, Principal API Architect, Layer 7
 
All about elasticsearch language clients
All about elasticsearch language clientsAll about elasticsearch language clients
All about elasticsearch language clients
 
WIT UNIT-5.pdf
WIT UNIT-5.pdfWIT UNIT-5.pdf
WIT UNIT-5.pdf
 
Ruby on rails for beginers
Ruby on rails for beginersRuby on rails for beginers
Ruby on rails for beginers
 

Último

SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
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
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
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
 
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
 
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
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
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
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
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
 

Último (20)

SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
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
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
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
 
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
 
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
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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 Glory of Rest

  • 4. WEB SERVICE A web service is an abstraction layer, like an operating system API or a programming language library.
  • 5. RPC-STYLE ARCHITECTURES envelope full of data HTTP and SOAP are envelope formats RPC-Style service defines it's own vocabulary RESTful WS share standard HTTP methods vocabulary REST Uniform Interface
  • 6. RESTful - different URIs for different values RPC-style - URI (service endpoint) for something that can be processed as a command
  • 7. REST-RPC HYBRID ARCHITECTURES Web service between the RESTful web services and the purely RPC-style services
  • 8. FEW REST-RPC EXAMPLES The The "REST" Many other allegedly RESTful web services Most web applications del.icio.us API Flickr web API
  • 9. SOAP AS A COMPETITOR TO REST The primary competitors to RESTful architectures are RPC architectures, not specific technologies like SOAP.
  • 10. RICHARDSON MATURITY MODEL Source: http://martinfowler.com
  • 11. LEVEL 0 - THE SWAMP OF POX HTTP POST for all interactions
  • 12. LEVEL 1 - RESOURCES Distinct URL per object
  • 13. LEVEL 2 - HTTP VERBS Rather than doing RPC style methods, we leverage HTTP
  • 14. LEVEL 3 - HYPERMEDIA CONTROLS Self-describing API
  • 15. SO WHAT IS THIS REST THING? REST simply dictates that a given resource have a unique address. You can interact with that address with standard HTTP verbs.
  • 17. TWO TYPES OF STATE: 1. application state - live on the client 2. resource state - live on the server
  • 18. Resource state stays on the server and is only sent to the client in the form of representations. Application state stays on the client until it can be used to create, modify, or delete a resource. Then it's sent to the server as part of POST, PUT, or DELETE request, and becomes resource state. RESTful service is "stateless" if the server never stores any application state.
  • 19. This is where the name "Representational State Transfer" comes from.
  • 20. ETAGS ETags are used to compare entities from the same resource. By supplying an entity tag value in a conditional request header.
  • 21. RESOURCE-ORIENTED BASICS different audience everything (interesting) thing represent as a resource representation of resources verbs, auxiliaries, complexity
  • 22. THE GENERIC ROA PROCEDURE 1. Figure out the data set 2. Split the data set into resources For each kind of resource: 3. Name the resources with URIs 4. Expose a subset of the uniform interface 5. Design the representation(s) accepted from the client 6. Design the representation(s) served to the client 7. Integrate this resource into existing resources, using hypermedia links and forms 8. Consider the typical course of events: what’s supposed to happen? Standard control flows like the Atom Publishing Protocol can help. 9. Consider error conditions: what might go wrong? Again, standard control flows can help.
  • 23.
  • 26.
  • 28. GET, PUT, AND DELETE
  • 29. POST
  • 30. HEAD AND OPTIONS Retrieve a metadata-only representation: HTTP HEAD Check which HTTP methods a particular resource supports: HTTP OPTIONS
  • 32. OVERLOADING POST The real information may be in the URI, the HTTP headers, or the entity-body. However it happens, an element of the RPC style has crept into the service.
  • 33. SAFETY AND IDEMPOTENCE When correctly used, GET and HEAD requests are safe. GET, HEAD, PUT and DELETE requests are idempotent.
  • 34. URI DESING URIs are supposed to designate resources, not operations on the resources.
  • 35. MethodMethod URI TemplateURI Template Equivalent RPCEquivalent RPC OperationOperation PUT users/{username} createUserAccount GET users/{username} getUserAccount PUT users/{username} updateUserAccount DELETE users/{username} deleteUserAccount GET users/{username}/profile getUserProfile POST users/{username}/bookmarks createBookmark PUT users/{username}/bookmarks/{id} updateBookmark DELETE users/{username}/bookmarks/{id} deleteBookmark GET users/{username}/bookmarks/{id} getBookmark GET users/{username}/bookmarks?tag= {tag} getUserBookmarks GET {username}?tag={tag} getUserPublicBookmarks GET ?tag={tag} getPublicBookmarks
  • 36. Use commas when the order of the items matters, as it does in latitude and longitude: /earth/37.0,-95.2 Use semicolons when the order doesn’t matter: /color- blends/red;blue When designing URIs, use path variables to separate elements of a hierarchy, or a path through a directed graph. Use query variables only to suggest arguments being plugged into an algorithm, or when the other two techniques fail.
  • 37. REPRESENTATIONS Representations should be human-readable, but computer-oriented
  • 38. SERVICE VERSIONING Even a well-connected service might need to be versioned
  • 39. SECURITY HMAC "Authorization: AWS " + AWSAccessKeyId+ ":" + base64(hmac-sha1(VERB + "n" + CONTENT-MD5 + "n" + CONTENT-TYPE + "n" + DATE + "n" + CanonicalizedAmzHeaders + "n" + CanonicalizedResource)) Authorization: AWS 44CF9590006BF252F707:jZNOcbfWmD/A/f3hSvVzXZjM2HU=
  • 41. JSON
  • 42. If all you want to pass around are atomic values or lists or hashes of atomic values, JSON has many of the advantages of XML: it’s straightforwardly usable over the Internet, supports a wide variety of applications, it’s easy to write programs to process JSON, it has few optional features, it’s human-legible and reasonably clear, its design is formal and concise, JSON documents are easy to create, and it uses Unicode.
  • 43. If you’re writing JavaScript in a web browser, JSON is a natural fit. The XML APIs in the browser are comparitively clumsy and the natural mapping from JavaScript objects to JSON eliminates the serialization issues that arise if you’re careless with XML.
  • 44. One line of argument for JSON over XML is simplicity. If you mean it’s simpler to have a single data interchange format instead of two, that’s incontrovertibly the case. If you mean JSON is intrinsically simpler than XML, well, I’m not sure that’s so obvious. For bundles of atomic values, it’s a little simpler. And the JavaScript APIs are definitely simpler. But I’ve seen attempts to represent mixed content in JSON and simple they aren’t.
  • 45. XML
  • 46. XML deals remarkably well with the full richness of unstructured data. I’m not worried about the future of XML at all even if its death is gleefully celebrated by a cadre of web API designers.
  • 47. I look forward to seeing what the JSON folks do when they are asked to develop richer APIs. When they want to exchange less well strucured data, will they shoehorn it into JSON? I see occasional mentions of a schema language for JSON, will other languages follow?
  • 48. I predict there will come a day when someone wants to federate JSON data across several application domains. I wonder, when they discover that the key "width" means different things to different constituencies, will they invent namespaces too?
  • 49. JSON AND HYPERMEDIA HAL Media Types HAL and Links HAL and Resources HAL Embedded Resources
  • 50. ERROR HANDLING WHY STATUS CODES AREN’T ENOUGH?
  • 51. A status code simply isn’t enough information most of the time. Yes, you want to define standard status codes so that your clients can perform reasonable branching, but you also need a way to communicate details to the end-user, so that they can log the information for themselves, display information to their own end-users, and/or report it back to you so you can do something to resolve the situation.
  • 52. SOURCESRESTful Web Services Microsoft REST Spec Amazon's HMAC-SHA HTTP Method Definitions JSON and REST presentation HAL Specification
  • 53. THE END Sławomir Chrobak / Link to presentation: @schrobak http://schrobak.github.io/slides/tgor