SlideShare a Scribd company logo
1 of 23
Representational State Transfer (REST):
Representing Information in Web 2.0
Applications
Emilio F Zegarra
CS 2650
2
Hypertext Transfer Protocol (HTTP)
• A communications protocol
• Allows retrieving inter-linked text documents
(hypertext)
• World Wide Web.
• HTTP Verbs
• HEAD
• GET
• POST
• PUT
• DELETE
• TRACE
• OPTIONS
• CONNECT
Browser Web Server
GET /index.html HTTP/1.1
Host: www.pitt.edu
HTTP/1.1 200 OK
Content-Type: text/html
<html><head>…
3
Representational State Transfer (REST)
• A style of software architecture for distributed
hypermedia systems such as the World Wide Web.
• Introduced in the doctoral dissertation of Roy Fielding
• One of the principal authors of the HTTP specification.
• A collection of network architecture principles which
outline how resources are defined and addressed
4
REST and HTTP
• The motivation for REST was to capture the
characteristics of the Web which made the Web
successful.
• URI Addressable resources
• HTTP Protocol
• Make a Request – Receive Response – Display Response
• Exploits the use of the HTTP protocol beyond HTTP
POST and HTTP GET
• HTTP PUT, HTTP DELETE
5
REST - not a Standard
• REST is not a standard
• JSR 311: JAX-RS: The JavaTM API for RESTful Web Services
• But it uses several standards:
• HTTP
• URL
• XML/HTML/GIF/JPEG/etc (Resource Representations)
• text/xml, text/html, image/gif, image/jpeg, etc (Resource Types, MIME
Types)
6
Main Concepts
Nouns (Resources)
unconstrained
i.e., http://example.com/employees/12345
Verbs
constrained
i.e., GET
Representations
constrained
i.e., XML
REST
7
Resources
• The key abstraction of information in REST is a
resource.
• A resource is a conceptual mapping to a set of entities
• Any information that can be named can be a resource: a
document or image, a temporal service (e.g. "today's
weather in Los Angeles"), a collection of other resources, a
non-virtual object (e.g. a person), and so on
• Represented with a global identifier (URI in HTTP)
• http://www.boeing.com/aircraft/747
8
Naming Resources
• REST uses URI to identify resources
• http://localhost/books/
• http://localhost/books/ISBN-0011
• http://localhost/books/ISBN-0011/authors
• http://localhost/classes
• http://localhost/classes/cs2650
• http://localhost/classes/cs2650/students
• As you traverse the path from more generic to more
specific, you are navigating the data
9
Verbs
• Represent the actions to be performed on resources
• HTTP GET
• HTTP POST
• HTTP PUT
• HTTP DELETE
10
HTTP GET
• How clients ask for the information they seek.
• Issuing a GET request transfers the data from the
server to the client in some representation
• GET http://localhost/books
• Retrieve all books
• GET http://localhost/books/ISBN-0011021
• Retrieve book identified with ISBN-0011021
• GET http://localhost/books/ISBN-0011021/authors
• Retrieve authors for book identified with ISBN-0011021
11
HTTP PUT, HTTP POST
• HTTP POST creates a resource
• HTTP PUT updates a resource
• POST http://localhost/books/
• Content: {title, authors[], …}
• Creates a new book with given properties
• PUT http://localhost/books/isbn-111
• Content: {isbn, title, authors[], …}
• Updates book identified by isbn-111 with submitted properties
12
HTTP DELETE
• Removes the resource identified by the URI
• DELETE http://localhost/books/ISBN-0011
• Delete book identified by ISBN-0011
13
Representations
• How data is represented or returned to the client for
presentation.
• Two main formats:
• JavaScript Object Notation (JSON)
• XML
• It is common to have multiple representations of the
same data
14
Representations
• XML
• <COURSE>
• <ID>CS2650</ID>
• <NAME>Distributed Multimedia Software</NAME>
• </COURSE>
• JSON
• {course
• {id: CS2650}
• {name: Distributed Multimedia Sofware}
• }
15
Why is it called
"Representational State Transfer"?
Resource
Client
http://www.boeing.com/aircraft/747
Boeing747.html
The Client references a Web resource using a URL. A representation of the resource is returned (in
this case as an HTML document).
The representation (e.g., Boeing747.html) places the client application in a state. The result of the
client traversing a hyperlink in Boeing747.html is another resource accessed. The new representation
places the client application into yet another state. Thus, the client application changes (transfers) state
with each resource representation --> Representation State Transfer!
Fuel requirements
Maintenance schedule
...
16
Request
(XML doc)
Response
(XML doc)
Web/Proxy
Server
HTTP GET
URL 1
HTTP Response
doGet()
Request
(XML doc)
Response
(JSON doc)
HTTP POST
URL 1
HTTP Response
doPost(id)
REST Engine
(locate resource
and generate
response)
PO
(XML doc)
HTTP DELETE
URL 1
doDelete()
Response
(TEXT doc)
HTTP Response
Architecture Style
17
Real Life Examples
• Google Maps
• Google AJAX Search API
• Yahoo Search API
• Amazon WebServices
18
REST and the Web
• The Web is an example of a REST system!
• All of those Web services that you have been using all
these many years - book ordering services, search
services, online dictionary services, etc - are REST-
based Web services.
• Alas, you have been using REST, building REST
services and you didn't even know it.
19
REST Implementations
• Restlet
• http://www.restlet.org/
• Project Zero
• http://www.projectzero.org
• GlassFish Jersey
• https://jersey.dev.java.net/
• JBoss RESTeasy
• http://www.jboss.org/resteasy/
20
My Project - Web 2.0 IC Card
• Objective
• Transform the IC Card Application to support
REST resources
• http://www.cs.pitt.edu/icms/iccards
• http://www.cs.pitt.edu/icms/iccards/001
• http://www.cs.pitt.edu/icms/groups/1/users
21
Invocation Model
Client REST Service
Database
Channels
http http
SQL
22
Tasks
• Design a REST resource model for the IC Card
• Review persistent model (MySql)
• Configure a REST engine (Project Zero)
• Create a new Rich User Interface (DOJO Toolkit)
23
References
• Representational State Transfer
http://en.wikipedia.org/wiki/Representational_State_Tr
ansfer
• Roy Fieldings Thesis
http://www.ics.uci.edu/~fielding/pubs/dissertation/top.h
tm

More Related Content

Similar to emilio.ppt

ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiTiago Knoch
 
Rest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsRest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsCarol McDonald
 
Deploying RDF Linked Data via Virtuoso Universal Server
Deploying RDF Linked Data via Virtuoso Universal ServerDeploying RDF Linked Data via Virtuoso Universal Server
Deploying RDF Linked Data via Virtuoso Universal Serverrumito
 
JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011Shreedhar Ganapathy
 
web connectivity in IoT
web connectivity in IoTweb connectivity in IoT
web connectivity in IoTFabMinds
 
Creating Restful Web Services with restish
Creating Restful Web Services with restishCreating Restful Web Services with restish
Creating Restful Web Services with restishGrig Gheorghiu
 
Consuming RESTful Web services in PHP
Consuming RESTful Web services in PHPConsuming RESTful Web services in PHP
Consuming RESTful Web services in PHPZoran Jeremic
 
Consuming RESTful services in PHP
Consuming RESTful services in PHPConsuming RESTful services in PHP
Consuming RESTful services in PHPZoran Jeremic
 
Building Ext JS Using HATEOAS - Jeff Stano
Building Ext JS Using HATEOAS - Jeff StanoBuilding Ext JS Using HATEOAS - Jeff Stano
Building Ext JS Using HATEOAS - Jeff StanoSencha
 
application of http.pptx
application of http.pptxapplication of http.pptx
application of http.pptxssuseraf60311
 
RESTful services
RESTful servicesRESTful services
RESTful servicesgouthamrv
 
API Testing. Streamline your testing process.
API Testing. Streamline your testing process.API Testing. Streamline your testing process.
API Testing. Streamline your testing process.Andrey Oleynik
 
Restful web services with java
Restful web services with javaRestful web services with java
Restful web services with javaVinay Gopinath
 
RESTful for opentravel.org by HP
RESTful for opentravel.org by HPRESTful for opentravel.org by HP
RESTful for opentravel.org by HPRoni Schuetz
 

Similar to emilio.ppt (20)

ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
 
IP UNIT 1.pptx
IP UNIT 1.pptxIP UNIT 1.pptx
IP UNIT 1.pptx
 
Rest
RestRest
Rest
 
Rest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.jsRest with Java EE 6 , Security , Backbone.js
Rest with Java EE 6 , Security , Backbone.js
 
Browser
BrowserBrowser
Browser
 
Deploying RDF Linked Data via Virtuoso Universal Server
Deploying RDF Linked Data via Virtuoso Universal ServerDeploying RDF Linked Data via Virtuoso Universal Server
Deploying RDF Linked Data via Virtuoso Universal Server
 
JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011JAX-RS JavaOne Hyderabad, India 2011
JAX-RS JavaOne Hyderabad, India 2011
 
week_05h
week_05hweek_05h
week_05h
 
Rest
Rest Rest
Rest
 
web connectivity in IoT
web connectivity in IoTweb connectivity in IoT
web connectivity in IoT
 
Creating Restful Web Services with restish
Creating Restful Web Services with restishCreating Restful Web Services with restish
Creating Restful Web Services with restish
 
Consuming RESTful Web services in PHP
Consuming RESTful Web services in PHPConsuming RESTful Web services in PHP
Consuming RESTful Web services in PHP
 
Consuming RESTful services in PHP
Consuming RESTful services in PHPConsuming RESTful services in PHP
Consuming RESTful services in PHP
 
Building Ext JS Using HATEOAS - Jeff Stano
Building Ext JS Using HATEOAS - Jeff StanoBuilding Ext JS Using HATEOAS - Jeff Stano
Building Ext JS Using HATEOAS - Jeff Stano
 
application of http.pptx
application of http.pptxapplication of http.pptx
application of http.pptx
 
RESTful services
RESTful servicesRESTful services
RESTful services
 
API Testing. Streamline your testing process.
API Testing. Streamline your testing process.API Testing. Streamline your testing process.
API Testing. Streamline your testing process.
 
Restful web services with java
Restful web services with javaRestful web services with java
Restful web services with java
 
Rest
RestRest
Rest
 
RESTful for opentravel.org by HP
RESTful for opentravel.org by HPRESTful for opentravel.org by HP
RESTful for opentravel.org by HP
 

Recently uploaded

Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
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
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 

Recently uploaded (20)

DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
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...
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 

emilio.ppt

  • 1. Representational State Transfer (REST): Representing Information in Web 2.0 Applications Emilio F Zegarra CS 2650
  • 2. 2 Hypertext Transfer Protocol (HTTP) • A communications protocol • Allows retrieving inter-linked text documents (hypertext) • World Wide Web. • HTTP Verbs • HEAD • GET • POST • PUT • DELETE • TRACE • OPTIONS • CONNECT Browser Web Server GET /index.html HTTP/1.1 Host: www.pitt.edu HTTP/1.1 200 OK Content-Type: text/html <html><head>…
  • 3. 3 Representational State Transfer (REST) • A style of software architecture for distributed hypermedia systems such as the World Wide Web. • Introduced in the doctoral dissertation of Roy Fielding • One of the principal authors of the HTTP specification. • A collection of network architecture principles which outline how resources are defined and addressed
  • 4. 4 REST and HTTP • The motivation for REST was to capture the characteristics of the Web which made the Web successful. • URI Addressable resources • HTTP Protocol • Make a Request – Receive Response – Display Response • Exploits the use of the HTTP protocol beyond HTTP POST and HTTP GET • HTTP PUT, HTTP DELETE
  • 5. 5 REST - not a Standard • REST is not a standard • JSR 311: JAX-RS: The JavaTM API for RESTful Web Services • But it uses several standards: • HTTP • URL • XML/HTML/GIF/JPEG/etc (Resource Representations) • text/xml, text/html, image/gif, image/jpeg, etc (Resource Types, MIME Types)
  • 6. 6 Main Concepts Nouns (Resources) unconstrained i.e., http://example.com/employees/12345 Verbs constrained i.e., GET Representations constrained i.e., XML REST
  • 7. 7 Resources • The key abstraction of information in REST is a resource. • A resource is a conceptual mapping to a set of entities • Any information that can be named can be a resource: a document or image, a temporal service (e.g. "today's weather in Los Angeles"), a collection of other resources, a non-virtual object (e.g. a person), and so on • Represented with a global identifier (URI in HTTP) • http://www.boeing.com/aircraft/747
  • 8. 8 Naming Resources • REST uses URI to identify resources • http://localhost/books/ • http://localhost/books/ISBN-0011 • http://localhost/books/ISBN-0011/authors • http://localhost/classes • http://localhost/classes/cs2650 • http://localhost/classes/cs2650/students • As you traverse the path from more generic to more specific, you are navigating the data
  • 9. 9 Verbs • Represent the actions to be performed on resources • HTTP GET • HTTP POST • HTTP PUT • HTTP DELETE
  • 10. 10 HTTP GET • How clients ask for the information they seek. • Issuing a GET request transfers the data from the server to the client in some representation • GET http://localhost/books • Retrieve all books • GET http://localhost/books/ISBN-0011021 • Retrieve book identified with ISBN-0011021 • GET http://localhost/books/ISBN-0011021/authors • Retrieve authors for book identified with ISBN-0011021
  • 11. 11 HTTP PUT, HTTP POST • HTTP POST creates a resource • HTTP PUT updates a resource • POST http://localhost/books/ • Content: {title, authors[], …} • Creates a new book with given properties • PUT http://localhost/books/isbn-111 • Content: {isbn, title, authors[], …} • Updates book identified by isbn-111 with submitted properties
  • 12. 12 HTTP DELETE • Removes the resource identified by the URI • DELETE http://localhost/books/ISBN-0011 • Delete book identified by ISBN-0011
  • 13. 13 Representations • How data is represented or returned to the client for presentation. • Two main formats: • JavaScript Object Notation (JSON) • XML • It is common to have multiple representations of the same data
  • 14. 14 Representations • XML • <COURSE> • <ID>CS2650</ID> • <NAME>Distributed Multimedia Software</NAME> • </COURSE> • JSON • {course • {id: CS2650} • {name: Distributed Multimedia Sofware} • }
  • 15. 15 Why is it called "Representational State Transfer"? Resource Client http://www.boeing.com/aircraft/747 Boeing747.html The Client references a Web resource using a URL. A representation of the resource is returned (in this case as an HTML document). The representation (e.g., Boeing747.html) places the client application in a state. The result of the client traversing a hyperlink in Boeing747.html is another resource accessed. The new representation places the client application into yet another state. Thus, the client application changes (transfers) state with each resource representation --> Representation State Transfer! Fuel requirements Maintenance schedule ...
  • 16. 16 Request (XML doc) Response (XML doc) Web/Proxy Server HTTP GET URL 1 HTTP Response doGet() Request (XML doc) Response (JSON doc) HTTP POST URL 1 HTTP Response doPost(id) REST Engine (locate resource and generate response) PO (XML doc) HTTP DELETE URL 1 doDelete() Response (TEXT doc) HTTP Response Architecture Style
  • 17. 17 Real Life Examples • Google Maps • Google AJAX Search API • Yahoo Search API • Amazon WebServices
  • 18. 18 REST and the Web • The Web is an example of a REST system! • All of those Web services that you have been using all these many years - book ordering services, search services, online dictionary services, etc - are REST- based Web services. • Alas, you have been using REST, building REST services and you didn't even know it.
  • 19. 19 REST Implementations • Restlet • http://www.restlet.org/ • Project Zero • http://www.projectzero.org • GlassFish Jersey • https://jersey.dev.java.net/ • JBoss RESTeasy • http://www.jboss.org/resteasy/
  • 20. 20 My Project - Web 2.0 IC Card • Objective • Transform the IC Card Application to support REST resources • http://www.cs.pitt.edu/icms/iccards • http://www.cs.pitt.edu/icms/iccards/001 • http://www.cs.pitt.edu/icms/groups/1/users
  • 21. 21 Invocation Model Client REST Service Database Channels http http SQL
  • 22. 22 Tasks • Design a REST resource model for the IC Card • Review persistent model (MySql) • Configure a REST engine (Project Zero) • Create a new Rich User Interface (DOJO Toolkit)
  • 23. 23 References • Representational State Transfer http://en.wikipedia.org/wiki/Representational_State_Tr ansfer • Roy Fieldings Thesis http://www.ics.uci.edu/~fielding/pubs/dissertation/top.h tm