2. The History of ReST
• Roy Fielding
– 2000 Dissertation
“Architectural Styles and the Design of
Network-based Software Architectures”
• ReST is Conceptual
3. Important Terms
• ReST – Representational State Transfer
• API – Application Programming
Interface
• CRUD – Create, Read, Update, Delete
based on Hyper Text Transfer Protocol
Actions
– Implemented using GET, POST, PUT, and
DELETE
4. What does ReST do?
• ReST defines how a client and server
will exchange and represent information
about a resource.
– A resource is simply any piece of
information that can be named. Such as
documents, images, services, and data.
5. Components of ReST
• Constraints
– Provide the framework for implementation
of the API
• Elements
– Are used for the request and response for
access to information
• Connectors
– Initiate the communication
6. ReST – 6 Constraints
• Client/Server
– Separates data storage from user interface
• Stateless
– Session state resides on client, the server
stores no session data
• Cacheable
– Allows data to be stored with the option for
the client to refuse
7. Constraints continued
• Uniform Interface
– Standardizes the form of the information
transferred
• Layered
– Encapsulated data allowing security
policies to be enforced
• Code on Demand
– Optional, but allows scripts to be used on
the client side
8. ReST 6 Data Elements
• Resource
– The target of the http reference
• Resource Identifier
– The link to the resource
• Representation
– The data type associated with the resource
such as: JPEG images or HTML
documents
9. Data Elements continued
• Representation metadata
– Attributes that help define the
representation
• Resource metadata
– Attributes that help define the resource
• Control data
– Identifies the purpose of the message
10. ReST Connectors
• Client
– Initiates by making a request
• Sever
– Listens and responds to client requests
• Cache
– Saves responses to be used later
• Resolver
– Translates the resource identifier into a network
address
• Tunnel
– Allows clients to communicate directly with the server
11. ReST API Example
Client Request:
GET http://www.thomas-bayer.com/sqlrest/CUSTOMER/3/
Server Response:
<CUSTOMER xmlns:xlink="http://www.w3.org/1999/xlink">
<ID>3</ID>
<FIRSTNAME>Michael</FIRSTNAME>
<LASTNAME>Clancy</LASTNAME>
<STREET>542 Upland Pl.</STREET>
<CITY>San Francisco</CITY>
</CUSTOMER>
12. Conclusion
• ReSTful APIs are used extensively
• 8,000+ APIs available
– http://www.programmableweb.com/apis/directory
• Everyday Examples:
– Social Media – Twitter and Facebook
– Banking web applications
– Electronic Medical Records
• ReSTful APIs are a mainstay in today’s
data driven world.
Editor's Notes
I chose to research ReSTful APIs because the company I work for uses them in the electronic medical record software that we develop and support. I wanted to know more about ReST and APIs so that as they become more widely used I would have a fundamental understating of what they are and what they do.
Roy Fielding’s dissertation in 2000 brought forth a new framework called Representational State Transfer also know as ReSTful. ReST is an architecture or framework behind the exchange of information using application programming interfaces. During the following presentation we will be introduced the fundamental aspects of ReST.
ReST is more of a concept or a set of best practices, rather than something concrete which makes it somewhat difficult to grasp.
Stateless – Advantages: reliability, visibility and scalability. Disadvantages: Decreased network performance due to repetitive data transfers
Cacheable – Advantages: reduces repetitive data transfers which increases network performance. Disadvantages: Data may become stale
Uniform Interface – Advantages: Conforms to the architectural principles of generality, and simplicity. Disadvantages: may not be as efficient as other forms of data transfer
Layered – Advantages: provides data security. Disadvantages: may increase system latency.
Code on Demand – Allow scripts to manipulate the data to be represented in a meaningful way. Disadvantages: Depending on the organizations security policies, scripts may not be allowed.
Resource – data that can be named as we discussed in slide 4
Resource Identifier – the URL of the resource being requested
Representation – may also be XML, JSON, hCard or any other defined representations
Lets put it all together using an example:
The request contains the purpose of the message GET
It also contains the target Customer 3
Using the resource identifier http://www.thomas-bayer.com
The response shows what type of representation, in this case XML
The resource metadata which is the information that defines the customer
In their book Restful Java Web Services: Master Core REST Concepts And Create Restful Web Services In Java, Sandoval, Roussev and Wallace describe ReST like this:
“In their simplest form, ReSTful web services are networked applications that manipulate the state of resources. In this context, resource manipulation means resource creation, retrieval, update, and deletion. However, ReSTful web services are not limited to just these four basic data manipulation concepts.”