SlideShare a Scribd company logo
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

PPTX
Learn REST API at ASIT
 
PPTX
rest-api-basics.pptx
PDF
RestfuléŁŽæ ŒÂžÂ„webæœćŠĄæž¶æž„
PPTX
RESTful Web Services
PDF
REST APIS web development for backend familiarity
PPTX
RESTful services
PDF
REST - Representational State Transfer
PPTX
REST and RESTful Services
Learn REST API at ASIT
 
rest-api-basics.pptx
RestfuléŁŽæ ŒÂžÂ„webæœćŠĄæž¶æž„
RESTful Web Services
REST APIS web development for backend familiarity
RESTful services
REST - Representational State Transfer
REST and RESTful Services

Similar to emilio.ppt (20)

PPTX
rest-api-basics.pptx
PPTX
Tutorial_Rest_API_For_Beginners_125.pptx
PPTX
RESTful APIs
PDF
What is REST?
PPTX
JAX-RS. Developing RESTful APIs with Java
PPTX
Restful Fundamentals
PPTX
Restful Fundamentals
PDF
[2015/2016] The REST architectural style
PDF
Designing RESTful APIs
PPTX
REST Presentation
PPTX
Rest APIs Training
PDF
RESTful web
PDF
Creating Restful Web Services with restish
PPT
Introduction to REST and the Restlet Framework
PPTX
Rest with Java EE 6 , Security , Backbone.js
PPTX
PDF
ReST Vs SOA(P) ... Yawn
 
PPTX
Rest surekha
PPT
Treinamento 1
PPTX
Overview of REST - Raihan Ullah
 
rest-api-basics.pptx
Tutorial_Rest_API_For_Beginners_125.pptx
RESTful APIs
What is REST?
JAX-RS. Developing RESTful APIs with Java
Restful Fundamentals
Restful Fundamentals
[2015/2016] The REST architectural style
Designing RESTful APIs
REST Presentation
Rest APIs Training
RESTful web
Creating Restful Web Services with restish
Introduction to REST and the Restlet Framework
Rest with Java EE 6 , Security , Backbone.js
ReST Vs SOA(P) ... Yawn
 
Rest surekha
Treinamento 1
Overview of REST - Raihan Ullah
 
Ad

Recently uploaded (20)

PPT
Introduction Database Management System for Course Database
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PPTX
Transform Your Business with a Software ERP System
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
Online Work Permit System for Fast Permit Processing
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
history of c programming in notes for students .pptx
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Understanding Forklifts - TECH EHS Solution
Introduction Database Management System for Course Database
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Softaken Excel to vCard Converter Software.pdf
How Creative Agencies Leverage Project Management Software.pdf
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Transform Your Business with a Software ERP System
How to Choose the Right IT Partner for Your Business in Malaysia
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Online Work Permit System for Fast Permit Processing
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
history of c programming in notes for students .pptx
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
CHAPTER 2 - PM Management and IT Context
How to Migrate SBCGlobal Email to Yahoo Easily
VVF-Customer-Presentation2025-Ver1.9.pptx
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Which alternative to Crystal Reports is best for small or large businesses.pdf
Understanding Forklifts - TECH EHS Solution
Ad

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