SlideShare una empresa de Scribd logo
1 de 14
Representational State
Transfer (REST)
BY
Prabhat Gangwar
What is REST?
• Network Architectural style
• Coined by Roy Fielding in his Ph.D.
dissertation in 2000
• Overview:
– Resources are defined and addressed
– Transmits domain-specific data over HTTP
– Does not have any SOAP messaging layer or
HTTP cookies
REST is not a standard
• No W3C specification (EDIT: But there is an
XML database that has such an API: eXist)
• REST is built on the concepts:
– HTTP (transferring mechanism)
– URL (resource address)
– XML/HTML/GIF/JPEG (Resource representations)
– text/xml, text/html, image/gif, image/jpeg (MIME
types)
Web services: Company example
• Build a web service to enable its
customers to
– Get list of items
– Get details about a particular item
– Purchase Order (PO)
WebServer
HTTP POST PO.xml
PO
(HTML/XML)
HTTP GET request /items
HTTP responseURL to submitted PO
List of
Items
Item
Data
PO
HTTP response
Response
(HTML/XML doc)
HTTP response
Response
(HTML/XML doc)
HTTP GET request /00345
Time
A user session
Get list of items
• Access the URL: http://www.company.com/items
• How the list is generated is invisible to the user (loose coupling)
• The following XML document returned:
• Each item is retrieved via other links (key feature)
Get detail of an item
• Accessing the URL: http://www.company.com/items/00345
• Any data change will not affect the user as in accessing
http://www.company.com/items/00345.html (restricts the resource;
whereas a database could be underneath)
• Again, more in-depth links appear, enabling to more detailed
information
Submit Purchase Order (PO)
• On the client, an instance is created, e.g.
form
• client submits PO.xml as the payload of an
HTTP POST
• The server responds to the POST with an
URL
• The order is shared information between
the company and the client (the client may
DELETE it)
Characteristics
• Traversing links pulls representations (pull-based client-server
interaction)
• Each request must be self-sufficient, not taking advantage of any
store resource (stateless)
• Capability of storing responses to frequent requests (cacheable or
non-cacheable)
• Resources are access via (HTTP) GET, POST, PUT, DELETE
(uniform interface)
• Every resource is named using an URL (named resources)
• Resources are interconnected using URLs (interconnected resource
representations)
• Intermediate components, e.g. proxy servers, gateways, firewalls,
etc. can be inserted between clients and resources for performance,
security (layered components)
Steps in creating a RESTful system
1. Identify resources, e.g. list of items, detail of an item, purchase
order
2. Create a URL for every resource
[use nouns, not verbs]
http://www.company.com/items/00345
Instead of
http://www.company.com/items/getItem?id=00345
3. Categorize resources:
• Accessible via HTTP GET (read-only)
• Accessible also via POST, PUT, DELETE (modifiable)
4. Connect resources through hyperlinks
5. Specify the format of the response using a schema, e.g. DTD,
W3C schema, RelaxNG (also take care of POST or PUT
services)
6. Describe how your services should be invoked (in a WSDL or
HTML document)
REST Constrains (1)
• Client/Server constraints
– Separation of Concerns
– Independent evolution of Components
• Stateless Constraint
– Single request reveals everything
– Easier to recover from failures
– Server does not commit resources to each request
– May degrade network performance when having large requests
• Caching constraint
– Eliminates interactions
– Clients have the “right” to reuse cacheable data
– May degrade reliability due to stale data
REST Constrains (2)
• Uniform interface constrain
– Implementation decoupled from interfaces
- Adapting degrades efficiency
- Layered system constraint
- Architecture can be build hierarchically
- Added Overhead
- Code-on-demand (inactive code is
executed on the client when the user
requests it)
Advantage to SOAP technology
Structure Accessibility Extensibility Performance Security
REST Inter-
connections
(hyperlinks)
GET, PUT,
POST,
DELETE
(uniform
interface)
Yes, through
links
GET-base URIs
are cacheable
Can apply
{GET, PUT,
POST,
DELETE}
permissions
to a data
object
SOAP
RPC
OO paradigm
of
encapsulating
data
Specific and
numerous
methods
Cannot refer
to other
objects
outside the
system
Not cached by
any existing
technology
Have to
implement
suitable
strategy
References
• Main reference:
– Roger L. Costello, Building the Web Services the REST way,
http://www.xfront.com/REST-Web-Services.html
• Additional references:
– Paul Prescod, Second Generation Web Services,
http://webservices.xml.com/pub/a/ws/2002/02/06/rest.html?page=1
– Wikipedia article,
http://en.wikipedia.org/wiki/Representational_State_Transfer
– Henning Niss, REST for Web Services
http://www.itu.dk/courses/IWSJ/E2005/slides/lecture7.pdf
– Hao He, Implementing REST Web Services: Best Practices and
Guidelines
http://www.xml.com/pub/a/2004/08/11/rest.html?page=1
– Ryan Tamayko, How I explained REST to my wife
http://tomayko.com/articles/2004/12/12/rest-to-my-wife

Más contenido relacionado

La actualidad más candente

Web servers (l6)
Web servers (l6)Web servers (l6)
Web servers (l6)Nanhi Sinha
 
Web ,app and db server presentation
Web ,app and db server presentationWeb ,app and db server presentation
Web ,app and db server presentationParth Godhani
 
Websphere interview Questions
Websphere interview QuestionsWebsphere interview Questions
Websphere interview Questionsgummadi1
 
Web Server And Database Server
Web Server And Database ServerWeb Server And Database Server
Web Server And Database ServerMahbubur Rahman
 
SQL Server 2008 Positioning
SQL Server 2008 PositioningSQL Server 2008 Positioning
SQL Server 2008 Positioningukdpe
 
Server and Its Types - Presentation
Server and Its Types - PresentationServer and Its Types - Presentation
Server and Its Types - PresentationShakeel Haider
 
Mule core concepts
Mule core conceptsMule core concepts
Mule core conceptsSindhu VL
 
Multi-tenancy in Java
Multi-tenancy in JavaMulti-tenancy in Java
Multi-tenancy in Javaseges
 
REST - Representational state transfer
REST - Representational state transferREST - Representational state transfer
REST - Representational state transferTricode (part of Dept)
 
REST & RESTful Web Service
REST & RESTful Web ServiceREST & RESTful Web Service
REST & RESTful Web ServiceHoan Vu Tran
 
No Silverlight Application Is an Island of Richness
No Silverlight Application Is an Island of RichnessNo Silverlight Application Is an Island of Richness
No Silverlight Application Is an Island of Richnessukdpe
 
Overview of RESTful web services
Overview of RESTful web servicesOverview of RESTful web services
Overview of RESTful web servicesnbuddharaju
 
Mule database-connectors
Mule database-connectorsMule database-connectors
Mule database-connectorsPhaniu
 
Dot Net Nuke Presentation
Dot Net Nuke PresentationDot Net Nuke Presentation
Dot Net Nuke PresentationTony Cosentino
 
Restful web services by Sreeni Inturi
Restful web services by Sreeni InturiRestful web services by Sreeni Inturi
Restful web services by Sreeni InturiSreeni I
 
Soap vs. rest - which is right web service protocol for your need?
Soap vs. rest -  which is right web service protocol for your need?Soap vs. rest -  which is right web service protocol for your need?
Soap vs. rest - which is right web service protocol for your need?Vijay Prasad Gupta
 

La actualidad más candente (20)

Web servers (l6)
Web servers (l6)Web servers (l6)
Web servers (l6)
 
Web ,app and db server presentation
Web ,app and db server presentationWeb ,app and db server presentation
Web ,app and db server presentation
 
Websphere interview Questions
Websphere interview QuestionsWebsphere interview Questions
Websphere interview Questions
 
Web Server And Database Server
Web Server And Database ServerWeb Server And Database Server
Web Server And Database Server
 
SQL Server 2008 Positioning
SQL Server 2008 PositioningSQL Server 2008 Positioning
SQL Server 2008 Positioning
 
Server and Its Types - Presentation
Server and Its Types - PresentationServer and Its Types - Presentation
Server and Its Types - Presentation
 
Mule core concepts
Mule core conceptsMule core concepts
Mule core concepts
 
Real time web apps
Real time web appsReal time web apps
Real time web apps
 
Multi-tenancy in Java
Multi-tenancy in JavaMulti-tenancy in Java
Multi-tenancy in Java
 
REST - Representational state transfer
REST - Representational state transferREST - Representational state transfer
REST - Representational state transfer
 
REST & RESTful Web Service
REST & RESTful Web ServiceREST & RESTful Web Service
REST & RESTful Web Service
 
No Silverlight Application Is an Island of Richness
No Silverlight Application Is an Island of RichnessNo Silverlight Application Is an Island of Richness
No Silverlight Application Is an Island of Richness
 
Overview of RESTful web services
Overview of RESTful web servicesOverview of RESTful web services
Overview of RESTful web services
 
RESTEasy
RESTEasyRESTEasy
RESTEasy
 
Mule database-connectors
Mule database-connectorsMule database-connectors
Mule database-connectors
 
Dot Net Nuke Presentation
Dot Net Nuke PresentationDot Net Nuke Presentation
Dot Net Nuke Presentation
 
Restful web services by Sreeni Inturi
Restful web services by Sreeni InturiRestful web services by Sreeni Inturi
Restful web services by Sreeni Inturi
 
Soap vs. rest - which is right web service protocol for your need?
Soap vs. rest -  which is right web service protocol for your need?Soap vs. rest -  which is right web service protocol for your need?
Soap vs. rest - which is right web service protocol for your need?
 
Restful web services ppt
Restful web services pptRestful web services ppt
Restful web services ppt
 
Apache ActiveMQ
Apache ActiveMQ Apache ActiveMQ
Apache ActiveMQ
 

Destacado (20)

Mule anypoint platform
Mule anypoint platformMule anypoint platform
Mule anypoint platform
 
Presentation of Tax
Presentation of Tax Presentation of Tax
Presentation of Tax
 
Mule esb
Mule esbMule esb
Mule esb
 
Restful api modeling language
Restful api modeling languageRestful api modeling language
Restful api modeling language
 
Multiplatform
MultiplatformMultiplatform
Multiplatform
 
Jdbc drivers
Jdbc driversJdbc drivers
Jdbc drivers
 
Soap
SoapSoap
Soap
 
Jsp
JspJsp
Jsp
 
Bpm
BpmBpm
Bpm
 
Mule esb
Mule esbMule esb
Mule esb
 
Soap service
Soap serviceSoap service
Soap service
 
Seo
SeoSeo
Seo
 
Oracle real application_cluster
Oracle real application_clusterOracle real application_cluster
Oracle real application_cluster
 
EXtensible Markup Language
EXtensible Markup LanguageEXtensible Markup Language
EXtensible Markup Language
 
Buissness model analysis
Buissness model analysisBuissness model analysis
Buissness model analysis
 
Mule fundamentals
Mule fundamentalsMule fundamentals
Mule fundamentals
 
Api desgin
Api desginApi desgin
Api desgin
 
Leadership today
Leadership todayLeadership today
Leadership today
 
Health triangle
Health triangleHealth triangle
Health triangle
 
Oracle Enterprise Repository
Oracle Enterprise RepositoryOracle Enterprise Repository
Oracle Enterprise Repository
 

Similar a Rest

An Overview of Web Services: SOAP and REST
An Overview of Web Services: SOAP and REST An Overview of Web Services: SOAP and REST
An Overview of Web Services: SOAP and REST Ram Awadh Prasad, PMP
 
Restful web services with java
Restful web services with javaRestful web services with java
Restful web services with javaVinay Gopinath
 
REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API RecommendationsJeelani Shaik
 
Introduction to REST - API
Introduction to REST - APIIntroduction to REST - API
Introduction to REST - APIChetan Gadodia
 
Restful webservice
Restful webserviceRestful webservice
Restful webserviceDong Ngoc
 
REST Introduction.ppt
REST Introduction.pptREST Introduction.ppt
REST Introduction.pptKGSCSEPSGCT
 
Restful Fundamentals
Restful FundamentalsRestful Fundamentals
Restful FundamentalsSuresh Madhra
 
Restful Fundamentals
Restful FundamentalsRestful Fundamentals
Restful FundamentalsSuresh Madhra
 
Creating Restful Web Services with restish
Creating Restful Web Services with restishCreating Restful Web Services with restish
Creating Restful Web Services with restishGrig Gheorghiu
 
Introduction to Web Services
Introduction to Web ServicesIntroduction to Web Services
Introduction to Web ServicesJeffrey Anderson
 
Mike Taulty DevDays 2010 Silverlight 4 Networking
Mike Taulty DevDays 2010 Silverlight 4 NetworkingMike Taulty DevDays 2010 Silverlight 4 Networking
Mike Taulty DevDays 2010 Silverlight 4 Networkingukdpe
 
Resting on your laurels will get you powned
Resting on your laurels will get you pownedResting on your laurels will get you powned
Resting on your laurels will get you pownedDinis Cruz
 

Similar a Rest (20)

Mini-Training: Let's have a rest
Mini-Training: Let's have a restMini-Training: Let's have a rest
Mini-Training: Let's have a rest
 
REST Basics
REST BasicsREST Basics
REST Basics
 
An Overview of Web Services: SOAP and REST
An Overview of Web Services: SOAP and REST An Overview of Web Services: SOAP and REST
An Overview of Web Services: SOAP and REST
 
Restful web services with java
Restful web services with javaRestful web services with java
Restful web services with java
 
REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API Recommendations
 
ReSTfulAPIs
ReSTfulAPIsReSTfulAPIs
ReSTfulAPIs
 
On being RESTful
On being RESTfulOn being RESTful
On being RESTful
 
Introduction to REST - API
Introduction to REST - APIIntroduction to REST - API
Introduction to REST - API
 
Restful webservice
Restful webserviceRestful webservice
Restful webservice
 
REST Introduction.ppt
REST Introduction.pptREST Introduction.ppt
REST Introduction.ppt
 
Rest
Rest Rest
Rest
 
Restful Fundamentals
Restful FundamentalsRestful Fundamentals
Restful Fundamentals
 
Restful Fundamentals
Restful FundamentalsRestful Fundamentals
Restful Fundamentals
 
Creating Restful Web Services with restish
Creating Restful Web Services with restishCreating Restful Web Services with restish
Creating Restful Web Services with restish
 
ReST
ReSTReST
ReST
 
Introduction to Web Services
Introduction to Web ServicesIntroduction to Web Services
Introduction to Web Services
 
Mike Taulty DevDays 2010 Silverlight 4 Networking
Mike Taulty DevDays 2010 Silverlight 4 NetworkingMike Taulty DevDays 2010 Silverlight 4 Networking
Mike Taulty DevDays 2010 Silverlight 4 Networking
 
Resting on your laurels will get you powned
Resting on your laurels will get you pownedResting on your laurels will get you powned
Resting on your laurels will get you powned
 
gofortution
gofortutiongofortution
gofortution
 
Rest Webservice
Rest WebserviceRest Webservice
Rest Webservice
 

Más de Prabhat gangwar

Más de Prabhat gangwar (20)

Middleware
MiddlewareMiddleware
Middleware
 
Pseudolocalization
PseudolocalizationPseudolocalization
Pseudolocalization
 
Mule anypoint studio
Mule anypoint studioMule anypoint studio
Mule anypoint studio
 
What is cluster analysis
What is cluster analysisWhat is cluster analysis
What is cluster analysis
 
clustering and load balancing
clustering and load balancingclustering and load balancing
clustering and load balancing
 
Middleware systems overview and introduction
Middleware systems overview and introductionMiddleware systems overview and introduction
Middleware systems overview and introduction
 
Gsm architecture
Gsm architectureGsm architecture
Gsm architecture
 
Oracle vs-mulesoft-api-manager-features
Oracle vs-mulesoft-api-manager-featuresOracle vs-mulesoft-api-manager-features
Oracle vs-mulesoft-api-manager-features
 
Introducing adf business components
Introducing adf business componentsIntroducing adf business components
Introducing adf business components
 
File transfer methods
File transfer methodsFile transfer methods
File transfer methods
 
Ftp tftp
Ftp tftpFtp tftp
Ftp tftp
 
Global warming
Global warmingGlobal warming
Global warming
 
Vedic mathmetics
Vedic mathmeticsVedic mathmetics
Vedic mathmetics
 
Trends
TrendsTrends
Trends
 
E commerce buissness-model
E commerce buissness-modelE commerce buissness-model
E commerce buissness-model
 
Effective communication skills
Effective communication skillsEffective communication skills
Effective communication skills
 
Office politics
Office politicsOffice politics
Office politics
 
Introduction to xamarin
Introduction to xamarinIntroduction to xamarin
Introduction to xamarin
 
Add to the path on mac os x
Add to the path on mac os xAdd to the path on mac os x
Add to the path on mac os x
 
Cross platform mobile application devlopment
Cross platform mobile application devlopmentCross platform mobile application devlopment
Cross platform mobile application devlopment
 

Último

Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactisticshameyhk98
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationNeilDeclaro1
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answersdalebeck957
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 

Último (20)

Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answers
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 

Rest

  • 2. What is REST? • Network Architectural style • Coined by Roy Fielding in his Ph.D. dissertation in 2000 • Overview: – Resources are defined and addressed – Transmits domain-specific data over HTTP – Does not have any SOAP messaging layer or HTTP cookies
  • 3. REST is not a standard • No W3C specification (EDIT: But there is an XML database that has such an API: eXist) • REST is built on the concepts: – HTTP (transferring mechanism) – URL (resource address) – XML/HTML/GIF/JPEG (Resource representations) – text/xml, text/html, image/gif, image/jpeg (MIME types)
  • 4. Web services: Company example • Build a web service to enable its customers to – Get list of items – Get details about a particular item – Purchase Order (PO)
  • 5. WebServer HTTP POST PO.xml PO (HTML/XML) HTTP GET request /items HTTP responseURL to submitted PO List of Items Item Data PO HTTP response Response (HTML/XML doc) HTTP response Response (HTML/XML doc) HTTP GET request /00345 Time A user session
  • 6. Get list of items • Access the URL: http://www.company.com/items • How the list is generated is invisible to the user (loose coupling) • The following XML document returned: • Each item is retrieved via other links (key feature)
  • 7. Get detail of an item • Accessing the URL: http://www.company.com/items/00345 • Any data change will not affect the user as in accessing http://www.company.com/items/00345.html (restricts the resource; whereas a database could be underneath) • Again, more in-depth links appear, enabling to more detailed information
  • 8. Submit Purchase Order (PO) • On the client, an instance is created, e.g. form • client submits PO.xml as the payload of an HTTP POST • The server responds to the POST with an URL • The order is shared information between the company and the client (the client may DELETE it)
  • 9. Characteristics • Traversing links pulls representations (pull-based client-server interaction) • Each request must be self-sufficient, not taking advantage of any store resource (stateless) • Capability of storing responses to frequent requests (cacheable or non-cacheable) • Resources are access via (HTTP) GET, POST, PUT, DELETE (uniform interface) • Every resource is named using an URL (named resources) • Resources are interconnected using URLs (interconnected resource representations) • Intermediate components, e.g. proxy servers, gateways, firewalls, etc. can be inserted between clients and resources for performance, security (layered components)
  • 10. Steps in creating a RESTful system 1. Identify resources, e.g. list of items, detail of an item, purchase order 2. Create a URL for every resource [use nouns, not verbs] http://www.company.com/items/00345 Instead of http://www.company.com/items/getItem?id=00345 3. Categorize resources: • Accessible via HTTP GET (read-only) • Accessible also via POST, PUT, DELETE (modifiable) 4. Connect resources through hyperlinks 5. Specify the format of the response using a schema, e.g. DTD, W3C schema, RelaxNG (also take care of POST or PUT services) 6. Describe how your services should be invoked (in a WSDL or HTML document)
  • 11. REST Constrains (1) • Client/Server constraints – Separation of Concerns – Independent evolution of Components • Stateless Constraint – Single request reveals everything – Easier to recover from failures – Server does not commit resources to each request – May degrade network performance when having large requests • Caching constraint – Eliminates interactions – Clients have the “right” to reuse cacheable data – May degrade reliability due to stale data
  • 12. REST Constrains (2) • Uniform interface constrain – Implementation decoupled from interfaces - Adapting degrades efficiency - Layered system constraint - Architecture can be build hierarchically - Added Overhead - Code-on-demand (inactive code is executed on the client when the user requests it)
  • 13. Advantage to SOAP technology Structure Accessibility Extensibility Performance Security REST Inter- connections (hyperlinks) GET, PUT, POST, DELETE (uniform interface) Yes, through links GET-base URIs are cacheable Can apply {GET, PUT, POST, DELETE} permissions to a data object SOAP RPC OO paradigm of encapsulating data Specific and numerous methods Cannot refer to other objects outside the system Not cached by any existing technology Have to implement suitable strategy
  • 14. References • Main reference: – Roger L. Costello, Building the Web Services the REST way, http://www.xfront.com/REST-Web-Services.html • Additional references: – Paul Prescod, Second Generation Web Services, http://webservices.xml.com/pub/a/ws/2002/02/06/rest.html?page=1 – Wikipedia article, http://en.wikipedia.org/wiki/Representational_State_Transfer – Henning Niss, REST for Web Services http://www.itu.dk/courses/IWSJ/E2005/slides/lecture7.pdf – Hao He, Implementing REST Web Services: Best Practices and Guidelines http://www.xml.com/pub/a/2004/08/11/rest.html?page=1 – Ryan Tamayko, How I explained REST to my wife http://tomayko.com/articles/2004/12/12/rest-to-my-wife

Notas del editor

  1. SOAP = Service Oriented Architecture Protocol : protocol for exchanging XML-based documents over computer networks, using HTTP(S) The RPC pattern
  2. How can the list be generated?
  3. Answer URL? Shared?
  4. Layering on SOAP?