Representational State Transfer
Encyclopedia
Representational state transfer (REST) is a style of software architecture
for distributed
hypermedia
systems such as the World Wide Web
. The term representational state transfer was introduced and defined in 2000 by Roy Fielding
in his doctoral dissertation. Fielding is one of the principal authors of the Hypertext Transfer Protocol
(HTTP) specification versions 1.0 and 1.1.
Conforming to the REST constraints is referred to as being "RESTful".
/1.1, based on the existing design of HTTP/1.0. The largest implementation of a system conforming to the REST architectural style is the World Wide Web
. REST exemplifies how the Web's architecture emerged by characterizing and constraining the macro-interactions of the four components of the Web, namely origin servers
, gateways
, proxies
and clients
, without imposing limitations on the individual participants. As such, REST essentially governs the proper behavior of participants.
and servers
. Clients initiate requests to servers; servers process requests and return appropriate responses. Requests and responses are built around the transfer of representations of resources. A resource
can be essentially any coherent and meaningful concept that may be addressed. A representation
of a resource is typically a document that captures the current or intended state of a resource.
The client begins sending requests when it is ready to make the transition to a new state. While one or more requests are outstanding, the client is considered to be in transition. The representation of each application state contains links that may be used next time the client chooses to initiate a new state transition.
REST was initially described in the context of HTTP
, but is not limited to that protocol. RESTful architectures can be based on other Application Layer
protocols if they already provide a rich and uniform vocabulary for applications based on the transfer of meaningful representational state. RESTful applications maximize the use of the pre-existing, well-defined interface and other built-in capabilities provided by the chosen network protocol, and minimize the addition of new application-specific features on top of it.
, Internet media type
s, request and response codes, etc. REST uses these existing features of the HTTP protocol, and thus allows existing layered proxy and gateway components to perform additional functions on the network such as HTTP caching and security enforcement.
RPC
over HTTP, on the other hand, encourages each application designer to define a new and arbitrary vocabulary of nouns and verbs (for example
verb. This disregards many of HTTP's existing capabilities such as authentication, caching and content type negotiation, and may leave the application designer re-inventing many of these features within the new vocabulary. Examples of doing so may include the addition of methods such as
Client–server
Stateless
Cache
able
Layered system
Code on demand (optional)
Uniform interface
The only optional constraint of REST architecture is code on demand. If a service violates any other constraint, it cannot strictly be referred to as RESTful.
Complying with these constraints, and thus conforming to the REST architectural style, will enable any kind of distributed hypermedia system to have desirable emergent properties, such as performance, scalability, simplicity, modifiability, visibility, portability and reliability.
Identification of resources
Manipulation of resources through these representations
Self-descriptive messages
Hypermedia as the engine of application state
REST has been applied to describe the desired web architecture, to help identify existing problems, to compare alternative solutions, and to ensure that protocol extensions would not violate the core constraints that make the Web successful.
Fielding describes REST's effect on scalability thus:
(sources of specific information), each of which is referenced with a global identifier (e.g., a URI
in HTTP). In order to manipulate these resources, components of the network (user agents and origin servers) communicate via a standardized interface (e.g., HTTP) and exchange representations of these resources (the actual documents conveying the information). For example, a resource that represents a circle
may accept and return a representation that specifies a center point and radius, formatted in SVG
, but may also accept and return a representation that specifies any three distinct points along the curve (since this also uniquely identifies a circle) as a comma-separated list
.
Any number of connectors (e.g., clients
, servers
, cache
s, tunnels
, etc.) can mediate the request, but each does so without "seeing past" its own request (referred to as "layering," another constraint of REST and a common principle in many other parts of information and networking architecture). Thus, an application can interact with a resource by knowing two things: the identifier of the resource and the action required—it does not need to know whether there are caches, proxies, gateways, firewalls, tunnels, or anything else between it and the server actually holding the information. The application does, however, need to understand the format of the information (representation) returned, which is typically an HTML
, XML
or JSON
document of some kind, although it may be an image, plain text, or any other content.
) is a simple web service implemented using HTTP and the principles of REST. It is a collection of resources, with four defined aspects:
The following table shows how the HTTP methods are typically used to implement a web service.
The PUT and DELETE methods are idempotent methods. The GET method is a safe method, meaning that calling it produces no side-effects (this also implies idempotence).
Unlike SOAP
-based web services, there is no "official" standard for RESTful web services. This is because REST is an architecture, unlike SOAP, which is a protocol. Even though REST is not a standard, a RESTful implementation such as the Web can use standards like HTTP, URI, XML, etc.
(CMIP) was designed to allow the control of network resources by presenting their manageable characteristics as object attributes. The objects have parent-child relationships that are identified using distinguished names and attributes, which are read and modified by a set of CRUD operations. The notable non-restful aspect of CMIP is the M_ACTION operation although, wherever possible, designers of management information base
s (MIBs) would typically endeavour to represent controllable and stateful aspects of network equipment through attributes.
Software architecture
The software architecture of a system is the set of structures needed to reason about the system, which comprise software elements, relations among them, and properties of both...
for distributed
Distributed computing
Distributed computing is a field of computer science that studies distributed systems. A distributed system consists of multiple autonomous computers that communicate through a computer network. The computers interact with each other in order to achieve a common goal...
hypermedia
Hypermedia
Hypermedia is a computer-based information retrieval system that enables a user to gain or provide access to texts, audio and video recordings, photographs and computer graphics related to a particular subject.Hypermedia is a term created by Ted Nelson....
systems such as the World Wide Web
World Wide Web
The World Wide Web is a system of interlinked hypertext documents accessed via the Internet...
. The term representational state transfer was introduced and defined in 2000 by Roy Fielding
Roy Fielding
Roy Thomas Fielding is an American computer scientist, one of the principal authors of the HTTP specification, an authority on computer network architecture and co-founder of the Apache HTTP Server project....
in his doctoral dissertation. Fielding is one of the principal authors of the Hypertext Transfer Protocol
Hypertext Transfer Protocol
The Hypertext Transfer Protocol is a networking protocol for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web....
(HTTP) specification versions 1.0 and 1.1.
Conforming to the REST constraints is referred to as being "RESTful".
History
The REST architectural style was developed in parallel with HTTPHypertext Transfer Protocol
The Hypertext Transfer Protocol is a networking protocol for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web....
/1.1, based on the existing design of HTTP/1.0. The largest implementation of a system conforming to the REST architectural style is the World Wide Web
World Wide Web
The World Wide Web is a system of interlinked hypertext documents accessed via the Internet...
. REST exemplifies how the Web's architecture emerged by characterizing and constraining the macro-interactions of the four components of the Web, namely origin servers
Upstream server
In computer networking, upstream server refers to a server that provides service to another server. In other words, upstream server is a server that is located higher in the hierarchy of servers. The highest server in the hierarchy is sometimes called the origin server...
, gateways
Gateway (telecommunications)
In telecommunications, the term gateway has the following meaning:*In a communications network, a network node equipped for interfacing with another network that uses different protocols....
, proxies
Proxy server
In computer networks, a proxy server is a server that acts as an intermediary for requests from clients seeking resources from other servers. A client connects to the proxy server, requesting some service, such as a file, connection, web page, or other resource available from a different server...
and clients
Client (computing)
A client is an application or system that accesses a service made available by a server. The server is often on another computer system, in which case the client accesses the service by way of a network....
, without imposing limitations on the individual participants. As such, REST essentially governs the proper behavior of participants.
Concept
REST-style architectures consist of clientsClient (computing)
A client is an application or system that accesses a service made available by a server. The server is often on another computer system, in which case the client accesses the service by way of a network....
and servers
Server (computing)
In the context of client-server architecture, a server is a computer program running to serve the requests of other programs, the "clients". Thus, the "server" performs some computational task on behalf of "clients"...
. Clients initiate requests to servers; servers process requests and return appropriate responses. Requests and responses are built around the transfer of representations of resources. A resource
Resource (Web)
The concept of resource is primitive in the Web architecture, and is used in the definition of its fundamental elements. The term was first introduced to refer to targets of Uniform Resource Locators , but its definition has been further extended to include the referent of any Uniform Resource...
can be essentially any coherent and meaningful concept that may be addressed. A representation
Representation (systemics)
Representation, from the most general and abstract systemic perspective, relates to a role or function or a property of an abstract or real object, relation or changes.For example,* an ambassador or a sport team may represent its nation....
of a resource is typically a document that captures the current or intended state of a resource.
The client begins sending requests when it is ready to make the transition to a new state. While one or more requests are outstanding, the client is considered to be in transition. The representation of each application state contains links that may be used next time the client chooses to initiate a new state transition.
REST was initially described in the context of HTTP
Hypertext Transfer Protocol
The Hypertext Transfer Protocol is a networking protocol for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web....
, but is not limited to that protocol. RESTful architectures can be based on other Application Layer
Application layer
The Internet protocol suite and the Open Systems Interconnection model of computer networking each specify a group of protocols and methods identified by the name application layer....
protocols if they already provide a rich and uniform vocabulary for applications based on the transfer of meaningful representational state. RESTful applications maximize the use of the pre-existing, well-defined interface and other built-in capabilities provided by the chosen network protocol, and minimize the addition of new application-specific features on top of it.
HTTP examples
HTTP, for example, has a very rich vocabulary in terms of verbs (or "methods"), URIsUniform Resource Identifier
In computing, a uniform resource identifier is a string of characters used to identify a name or a resource on the Internet. Such identification enables interaction with representations of the resource over a network using specific protocols...
, Internet media type
Internet media type
An Internet media type, originally called a MIME type after MIME and sometimes a Content-type after the name of a header in several protocols whose value is such a type, is a two-part identifier for file formats on the Internet.The identifiers were originally defined in RFC 2046 for use in email...
s, request and response codes, etc. REST uses these existing features of the HTTP protocol, and thus allows existing layered proxy and gateway components to perform additional functions on the network such as HTTP caching and security enforcement.
SOAP RPC contrast
SOAPSOAP
SOAP, originally defined as Simple Object Access Protocol, is a protocol specification for exchanging structured information in the implementation of Web Services in computer networks...
RPC
Remote procedure call
In computer science, a remote procedure call is an inter-process communication that allows a computer program to cause a subroutine or procedure to execute in another address space without the programmer explicitly coding the details for this remote interaction...
over HTTP, on the other hand, encourages each application designer to define a new and arbitrary vocabulary of nouns and verbs (for example
getUsers
, savePurchaseOrder(...)
), usually overlaid onto the HTTP POSTPOST (HTTP)
In computing, POST is one of many request methods supported by the HTTP protocol used by the World Wide Web. The POST request method is used when the client needs to send data to the server as part of the request, such as when uploading a file or submitting a completed form.In contrast to the GET...
verb. This disregards many of HTTP's existing capabilities such as authentication, caching and content type negotiation, and may leave the application designer re-inventing many of these features within the new vocabulary. Examples of doing so may include the addition of methods such as
getNewUsersSince(Date date)
, savePurchaseOrder(string customerLogon, string password, ...)
.Constraints
The REST architectural style describes the following six constraints applied to the architecture, while leaving the implementation of the individual components free to design:Client–server
- A uniform interface separates clients from servers. This separation of concernsSeparation of concernsIn computer science, separation of concerns is the process of separating a computer program into distinct features that overlap in functionality as little as possible. A concern is any piece of interest or focus in a program. Typically, concerns are synonymous with features or behaviors...
means that, for example, clients are not concerned with data storage, which remains internal to each server, so that the portabilitySoftware portabilityPortability in high-level computer programming is the usability of the same software in different environments. The prerequirement for portability is the generalized abstraction between the application logic and system interfaces...
of client code is improved. Servers are not concerned with the user interface or user state, so that servers can be simpler and more scalableScalabilityIn electronics scalability is the ability of a system, network, or process, to handle growing amount of work in a graceful manner or its ability to be enlarged to accommodate that growth...
. Servers and clients may also be replaced and developed independently, as long as the interface is not altered.
Stateless
Stateless server
In computing, a stateless protocol is a communications protocol that treats each request as an independent transaction that is unrelated to any previous request so that the communication consists of independent pairs of requests and responses...
- The client–server communication is further constrained by no client context being stored on the server between requests. Each request from any client contains all of the information necessary to service the request, and any session state is held in the client. The server can be stateful; this constraint merely requires that server-side state be addressable by URL as a resource. This not only makes servers more visible for monitoringWebsite monitoringWebsite monitoring is the process of testing and verifying that end-users can interact with a website or web application. Website monitoring is often used by businesses to ensure that their sites are live and responding....
, but also makes them more reliableReliability (computer networking)In computer networking, a reliable protocol is one that provides reliability properties with respect to the delivery of data to the intended recipient, as opposed to an unreliable protocol, which does not provide notifications to the sender as to the delivery of transmitted data.A reliable...
in the face of partial network failures as well as further enhancing their scalability.
Cache
Cache
In computer engineering, a cache is a component that transparently stores data so that future requests for that data can be served faster. The data that is stored within a cache might be values that have been computed earlier or duplicates of original values that are stored elsewhere...
able
- As on the World Wide Web, clients can cache responses. Responses must therefore, implicitly or explicitly, define themselves as cacheable, or not, to prevent clients reusing stale or inappropriate data in response to further requests. Well-managed caching partially or completely eliminates some client–server interactions, further improving scalability and performance.
Layered system
Layered system
In telecommunication, a layered system is a system in which components are grouped, i.e., layered, in a hierarchical arrangement, such that lower layers provide functions and services that support the functions and services of higher layers....
- A client cannot ordinarily tell whether it is connected directly to the end server, or to an intermediary along the way. Intermediary servers may improve system scalability by enabling load-balancing and by providing shared caches. They may also enforce security policies.
Code on demand (optional)
Client-side scripting
Client-side scripting generally refers to the class of computer programs on the web that are executed client-side, by the user's web browser, instead of server-side...
- Servers are able to temporarily extend or customize the functionality of a client by transferring logic to it that it can execute. Examples of this may include compiled components such as Java appletJava appletA Java applet is an applet delivered to users in the form of Java bytecode. Java applets can run in a Web browser using a Java Virtual Machine , or in Sun's AppletViewer, a stand-alone tool for testing applets...
s and client-side scripts such as JavaScriptJavaScriptJavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....
.
Uniform interface
- The uniform interface between clients and servers, discussed below, simplifies and decouples the architecture, which enables each part to evolve independently. The four guiding principles of this interface are detailed below.
The only optional constraint of REST architecture is code on demand. If a service violates any other constraint, it cannot strictly be referred to as RESTful.
Complying with these constraints, and thus conforming to the REST architectural style, will enable any kind of distributed hypermedia system to have desirable emergent properties, such as performance, scalability, simplicity, modifiability, visibility, portability and reliability.
Guiding principles of the interface
The uniform interface that any REST interface must provide is considered fundamental to the design of any REST service.Identification of resources
- Individual resources are identified in requests, for example using URIsUniform Resource IdentifierIn computing, a uniform resource identifier is a string of characters used to identify a name or a resource on the Internet. Such identification enables interaction with representations of the resource over a network using specific protocols...
in web-based REST systems. The resources themselves are conceptually separate from the representations that are returned to the client. For example, the server does not send its database, but rather, perhaps, some HTMLHTMLHyperText Markup Language is the predominant markup language for web pages. HTML elements are the basic building-blocks of webpages....
, XMLXMLExtensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....
or JSONJSONJSON , or JavaScript Object Notation, is a lightweight text-based open standard designed for human-readable data interchange. It is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects...
that represents some database records expressed, for instance, in Finnish and encoded in UTF-8UTF-8UTF-8 is a multibyte character encoding for Unicode. Like UTF-16 and UTF-32, UTF-8 can represent every character in the Unicode character set. Unlike them, it is backward-compatible with ASCII and avoids the complications of endianness and byte order marks...
, depending on the details of the request and the server implementation.
Manipulation of resources through these representations
- When a client holds a representation of a resource, including any metadataMetadataThe term metadata is an ambiguous term which is used for two fundamentally different concepts . Although the expression "data about data" is often used, it does not apply to both in the same way. Structural metadata, the design and specification of data structures, cannot be about data, because at...
attached, it has enough information to modify or delete the resource on the server, provided it has permission to do so.
Self-descriptive messages
- Each message includes enough information to describe how to process the message. For example, which parser to invoke may be specified by an Internet media typeInternet media typeAn Internet media type, originally called a MIME type after MIME and sometimes a Content-type after the name of a header in several protocols whose value is such a type, is a two-part identifier for file formats on the Internet.The identifiers were originally defined in RFC 2046 for use in email...
(previously known as a MIMEMIMEMultipurpose Internet Mail Extensions is an Internet standard that extends the format of email to support:* Text in character sets other than ASCII* Non-text attachments* Message bodies with multiple parts...
type). Responses also explicitly indicate their cacheability.
Hypermedia as the engine of application state
HATEOAS
HATEOAS, an abbreviation for Hypermedia as the Engine of Application State, is a constraint of the REST application architecture that distinguishes it from most other network application architectures. The principle is that a client interacts with a network application entirely through hypermedia...
- Clients make state transitions only through actions that are dynamically identified within hypermedia by the server (e.g. by hyperlinkHyperlinkIn computing, a hyperlink is a reference to data that the reader can directly follow, or that is followed automatically. A hyperlink points to a whole document or to a specific element within a document. Hypertext is text with hyperlinks...
s within hypertextHypertextHypertext is text displayed on a computer or other electronic device with references to other text that the reader can immediately access, usually by a mouse click or keypress sequence. Apart from running text, hypertext may contain tables, images and other presentational devices. Hypertext is the...
). Except for simple fixed entry points to the application, a client does not assume that any particular actions will be available for any particular resources beyond those described in representations previously received from the server.
Key goals
Key goals of REST include:- ScalabilityScalabilityIn electronics scalability is the ability of a system, network, or process, to handle growing amount of work in a graceful manner or its ability to be enlarged to accommodate that growth...
of component interactions - Generality of interfacesInterface (computer science)In the field of computer science, an interface is a tool and concept that refers to a point of interaction between components, and is applicable at the level of both hardware and software...
- Independent deploymentSoftware deploymentSoftware deployment is all of the activities that make a software system available for use.The general deployment process consists of several interrelated activities with possible transitions between them. These activities can occur at the producer site or at the consumer site or both...
of components - Intermediary components to reduce latencyLatency (engineering)Latency is a measure of time delay experienced in a system, the precise definition of which depends on the system and the time being measured. Latencies may have different meaning in different contexts.-Packet-switched networks:...
, enforce securityData securityData security is the means of ensuring that data is kept safe from corruption and that access to it is suitably controlled. Thus data security helps to ensure privacy. It also helps in protecting personal data. Data security is part of the larger practice of Information security.- Disk Encryption...
and encapsulateInformation hidingIn computer science, information hiding is the principle of segregation of the design decisions in a computer program that are most likely to change, thus protecting other parts of the program from extensive modification if the design decision is changed...
legacy systemLegacy systemA legacy system is an old method, technology, computer system, or application program that continues to be used, typically because it still functions for the users' needs, even though newer technology or more efficient methods of performing a task are now available...
s
REST has been applied to describe the desired web architecture, to help identify existing problems, to compare alternative solutions, and to ensure that protocol extensions would not violate the core constraints that make the Web successful.
Fielding describes REST's effect on scalability thus:
Central principle
An important concept in REST is the existence of resourcesResource (Web)
The concept of resource is primitive in the Web architecture, and is used in the definition of its fundamental elements. The term was first introduced to refer to targets of Uniform Resource Locators , but its definition has been further extended to include the referent of any Uniform Resource...
(sources of specific information), each of which is referenced with a global identifier (e.g., a URI
Uniform Resource Identifier
In computing, a uniform resource identifier is a string of characters used to identify a name or a resource on the Internet. Such identification enables interaction with representations of the resource over a network using specific protocols...
in HTTP). In order to manipulate these resources, components of the network (user agents and origin servers) communicate via a standardized interface (e.g., HTTP) and exchange representations of these resources (the actual documents conveying the information). For example, a resource that represents a circle
Circle
A circle is a simple shape of Euclidean geometry consisting of those points in a plane that are a given distance from a given point, the centre. The distance between any of the points and the centre is called the radius....
may accept and return a representation that specifies a center point and radius, formatted in SVG
Scalable Vector Graphics
Scalable Vector Graphics is a family of specifications of an XML-based file format for describing two-dimensional vector graphics, both static and dynamic . The SVG specification is an open standard that has been under development by the World Wide Web Consortium since 1999.SVG images and their...
, but may also accept and return a representation that specifies any three distinct points along the curve (since this also uniquely identifies a circle) as a comma-separated list
Comma-separated values
A comma-separated values file stores tabular data in plain-text form. As a result, such a file is easily human-readable ....
.
Any number of connectors (e.g., clients
Client (computing)
A client is an application or system that accesses a service made available by a server. The server is often on another computer system, in which case the client accesses the service by way of a network....
, servers
Server (computing)
In the context of client-server architecture, a server is a computer program running to serve the requests of other programs, the "clients". Thus, the "server" performs some computational task on behalf of "clients"...
, cache
Cache
In computer engineering, a cache is a component that transparently stores data so that future requests for that data can be served faster. The data that is stored within a cache might be values that have been computed earlier or duplicates of original values that are stored elsewhere...
s, tunnels
Tunneling protocol
Computer networks use a tunneling protocol when one network protocol encapsulates a different payload protocol...
, etc.) can mediate the request, but each does so without "seeing past" its own request (referred to as "layering," another constraint of REST and a common principle in many other parts of information and networking architecture). Thus, an application can interact with a resource by knowing two things: the identifier of the resource and the action required—it does not need to know whether there are caches, proxies, gateways, firewalls, tunnels, or anything else between it and the server actually holding the information. The application does, however, need to understand the format of the information (representation) returned, which is typically an HTML
HTML
HyperText Markup Language is the predominant markup language for web pages. HTML elements are the basic building-blocks of webpages....
, XML
XML
Extensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....
or JSON
JSON
JSON , or JavaScript Object Notation, is a lightweight text-based open standard designed for human-readable data interchange. It is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects...
document of some kind, although it may be an image, plain text, or any other content.
RESTful web services
A RESTful web service (also called a RESTful web APIWeb api
A web API is typically a defined set of HTTP request messages along with a definition of the structure of response messages, typically expressed in JSON or XML...
) is a simple web service implemented using HTTP and the principles of REST. It is a collection of resources, with four defined aspects:
- the base URI for the web service, such as
http://example.com/resources/ - the Internet media typeInternet media typeAn Internet media type, originally called a MIME type after MIME and sometimes a Content-type after the name of a header in several protocols whose value is such a type, is a two-part identifier for file formats on the Internet.The identifiers were originally defined in RFC 2046 for use in email...
of the data supported by the web service. This is often JSONJSONJSON , or JavaScript Object Notation, is a lightweight text-based open standard designed for human-readable data interchange. It is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects...
, XMLXMLExtensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....
or YAMLYAMLYAML is a human-readable data serialization format that takes concepts from programming languages such as C, Perl, and Python, and ideas from XML and the data format of electronic mail . YAML was first proposed by Clark Evans in 2001, who designed it together with Ingy döt Net and Oren Ben-Kiki...
but can be any other valid Internet media type. - the set of operations supported by the web service using HTTP methods (e.g., GET, PUT, POST, or DELETE).
- The API must be hypertext driven.
The following table shows how the HTTP methods are typically used to implement a web service.
Resource | GET | PUT | POST | DELETE |
---|---|---|---|---|
Collection URI, such as
|
List the URIs and perhaps other details of the collection's members. | Replace the entire collection with another collection. | Create a new entry in the collection. The new entry's URL is assigned automatically and is usually returned by the operation. | Delete the entire collection. |
Element URI, such as
|
Retrieve a representation of the addressed member of the collection, expressed in an appropriate Internet media type. | Replace the addressed member of the collection, or if it doesn't exist, create it. | Treat the addressed member as a collection in its own right and create a new entry in it. | Delete the addressed member of the collection. |
The PUT and DELETE methods are idempotent methods. The GET method is a safe method, meaning that calling it produces no side-effects (this also implies idempotence).
Unlike SOAP
SOAP
SOAP, originally defined as Simple Object Access Protocol, is a protocol specification for exchanging structured information in the implementation of Web Services in computer networks...
-based web services, there is no "official" standard for RESTful web services. This is because REST is an architecture, unlike SOAP, which is a protocol. Even though REST is not a standard, a RESTful implementation such as the Web can use standards like HTTP, URI, XML, etc.
Public implementations
REST can be found in a number of places on the public Web:- The Atom Publishing ProtocolAtom (standard)The name Atom applies to a pair of related standards. The Atom Syndication Format is an XML language used for web feeds, while the Atom Publishing Protocol is a simple HTTP-based protocol for creating and updating web resources.Web feeds allow software programs to check for updates published on a...
for publishing to blogs is considered a canonical RESTful protocol. - Sun MicrosystemsSun MicrosystemsSun Microsystems, Inc. was a company that sold :computers, computer components, :computer software, and :information technology services. Sun was founded on February 24, 1982...
' Cloud API is a good example of resource media type documentation. - The Open Services for Lifecycle Collaboration (OSLC) initiative is establishing a RESTful approach to integrating software development artifacts.
- CouchDBCouchDBApache CouchDB, commonly referred to as CouchDB, is an open source document-oriented database written mostly in the Erlang programming language. It is part of the NoSQL group of data stores and is designed for local replication and to scale horizontally across a wide range of devices...
is a document-oriented database written in Erlang that provides a RESTful JSON API that can be accessed from any environment that allows HTTP requests. - MySQL ClusterMySQL ClusterMySQL Cluster is a technology which provides shared-nothing clustering capabilities for the MySQL database management system. It was first included in the production release of MySQL 4.1 in November 2004. It is designed to provide high availability and high performance, while allowing for nearly...
is a write-scalable auto-shardShard (database architecture)A database shard is a horizontal partition in a database or search engine. Each individual partition is referred to as a shard or database shard.- Database architecture :...
ed database also accessible through a native REST/JSON interface as an Apache module. - MicrosoftMicrosoftMicrosoft Corporation is an American public multinational corporation headquartered in Redmond, Washington, USA that develops, manufactures, licenses, and supports a wide range of products and services predominantly related to computing through its various product divisions...
's Canonical REST Entity Service. - NuxeoNuxeoNuxeo delivers an open source document management application built with a complete, modular and extensible open source platform for enterprise content management. Other packaged applications built with the platform provide solutions for digital asset management and case management...
, an open source document manager, implements a Content Automation interface via a REST API
- Sones GraphDBSones GraphDBSones GraphDB was developed by the company sones in Erfurt and Leipzig. GraphDB is a new type of database with its design based on weighted graphs. The open source edition has been available since July 2010...
is a graph-oriented database written in C# that provides a RESTful interface - Amazon AWS implements RESTful APIs as one option to interact between client and server.
- Amazon.comAmazon.comAmazon.com, Inc. is a multinational electronic commerce company headquartered in Seattle, Washington, United States. It is the world's largest online retailer. Amazon has separate websites for the following countries: United States, Canada, United Kingdom, Germany, France, Italy, Spain, Japan, and...
's S3 is their only truly REST offering;
- Amazon.com
Framework implementations
- .NET Open-Source - OpenRastaOpenRastaOpenRasta is a development framework targeting the Microsoft .NET platform for building web-based applications and services, and distributed under an Open-Source MIT License....
, ServiceStack, RestSharp - ColdFusionColdFusionIn computing, ColdFusion is the name of a commercial rapid application development platform invented by Jeremy and JJ Allaire in 1995. ColdFusion was originally designed to make it easier to connect simple HTML pages to a database, by version 2 it had...
- ColdFusion on WheelsColdFusion on WheelsColdFusion on Wheels is an open source web application framework designed for applications written in ColdFusion Markup Language. Its name is often shortened to CFWheels or Wheels....
, Mach-IIMach-IIMach-II is a web-application framework focused on easing software development and maintenance. It was the first Object-Oriented framework for CFML. It is maintained by a group of dedicated open source programmers-References:* * * *...
, Taffy - Ext JSExt (javascript library)Ext JS is a JavaScript library for building interactive web applications using techniques such as Ajax, DHTML and DOM scripting.Originally built as an add-on library extension of YUI by Jack Slocum, Ext includes interoperability with jQuery and Prototype...
- Grails JSON-REST-API plugin
- Java Jt Design Pattern Framework, Wink , RestletRestletRestlet is a lightweight, comprehensive, open source REST framework for the Java platform. Restlet is suitable for both server and client Web applications. It supports major Internet transport, data format, and service description standards like HTTP and HTTPS, SMTP, XML, JSON, Atom, and WADL...
, JBoss RESTEasy, Jersey, Apache CXFApache CXFApache CXF is an open-source, fully featured Web services framework. It originated as the combination of two open-source projects: Celtix developed by IONA Technologies and XFire developed by a team hosted at Codehaus. These two projects were combined by people working together at the Apache...
, NetKernelNetKernelNetKernel is an implementation of the resource oriented computing abstraction.ROC is a logical computing model that resides on top of but is completely isolated fromthe physical realm of code and objects....
, Apache SlingApache SlingApache Sling is an open source Web framework for the Java platform designed to create content-centric applications on top of a JSR-170-compliant content repository such as Apache Jackrabbit. Apache Sling allows developers to deploy their application components as OSGi bundles or as scripts and...
, Restfulie, Play FrameworkPlay FrameworkPlay is an open source web application framework, written in Java, which follows the model-view-controller architectural pattern. It aims to optimize developer productivity by using convention over configuration, hot code reloading and display of errors in the browser.Although Play is written in...
, Spring Framework, MuleMuleA mule is the offspring of a male donkey and a female horse. Horses and donkeys are different species, with different numbers of chromosomes. Of the two F1 hybrids between these two species, a mule is easier to obtain than a hinny... - Microsoft's WCF Data Services, WCF Web Api
- Microsoft's ASP.NET MVC, http://asp.net/mvc
- Perl CatalystCatalyst (software)Catalyst is an open source web application framework written in Perl, that closely follows the model–view–controller architecture, and supports a number of experimental web patterns. It is written using Moose, a modern object system for Perl...
, Dancer, MojoliciousMojoliciousMojolicious is a real-time web application framework, written by Sebastian Riedel, creator of the web application framework Catalyst. Licensed as free software under the Artistic License v 2.0, It is written in Perl, and is designed for use in both simple and complex web applications, based on... - PHP DooPHPDooPHPDooPHP is designed to be a lightweight, low footprint and easy to learn PHP framework.-Key Features:*Built-in authentication support *Database replication*Code Generation*l18n internationalization*RESTfulAPI*Support for Ajax...
, SymfonySymfonySymfony is a web application framework written in PHP which follows the model-view-controller paradigm. Released under the MIT license, Symfony is free software...
, Zend FrameworkZend FrameworkZend Framework is an open source, object-oriented web application framework implemented in PHP 5 and licensed under the New BSD License.-Licensing:...
, CakePHPCakePHPCakePHP is an open source web application framework for producing web applications. It is written in PHP, modeled after the concepts of Ruby on Rails, and distributed under the MIT License.-History:...
, KohanaKohanaKohana may refer to:*Kohana , a captive orca*Kohana, a Kamen Rider Den-O character*Kohana cat, a minor cat breed*Kohana Framework, a PHP 5 framework*Kohana , a local holiday in the Netherlands...
, Sapphire, FRAPI, RECESS, Simple-REST - Python Tastypie, django-piston, django-rest-framework, django-rest-interface django-restapi, web.py, lazr.restful
- REST microkernel and software platform NetKernelNetKernelNetKernel is an implementation of the resource oriented computing abstraction.ROC is a logical computing model that resides on top of but is completely isolated fromthe physical realm of code and objects....
- Ruby Ruby on RailsRuby on RailsRuby on Rails, often shortened to Rails or RoR, is an open source web application framework for the Ruby programming language.-History:...
, SinatraSinatra (software)Sinatra is a free and open source web application library and domain-specific language written in Ruby. It is an alternative to other Ruby web application frameworks such as Ruby on Rails, Merb, Nitro, Camping, and Rango. It is dependent on the Rack web server interface.Designed and developed by...
, Restfulie - TurboGearsTurboGearsTurboGears is a Python web application framework consisting of several WSGI components such as Pylons, SQLAlchemy, Genshi and Repoze.TurboGears is designed around the model-view-controller architecture, much like Struts or Ruby on Rails, designed to make rapid web application development in Python...
2 provides a RestController - ZEST - lightweight Struts-like Web framework
- ERRest - REST framework for Apple's WebObjectsWebObjectsWebObjects was a Java web application server from Apple Inc., and a web application framework that ran on the server. It was available at no additional cost. Its hallmark features were its object-orientation, database connectivity, and prototyping tools...
- MuleMule (software)Mule is a lightweight enterprise service bus and integration framework. It can handle services and applications using disparate transport and messaging technologies...
light-weight integration platform with strong REST and SOAP capabilities
Outside the Web
Software that may interact with a number of different kinds of objects or devices can do so by virtue of a uniform, agreed interface.CMIP
The Common Management Information ProtocolCommon management information protocol
The Common Management Information Protocol is the OSI specified network management protocol.Defined in . It provides an implementation for the services defined by the Common Management Information Service specified in , allowing communication between network management applications and...
(CMIP) was designed to allow the control of network resources by presenting their manageable characteristics as object attributes. The objects have parent-child relationships that are identified using distinguished names and attributes, which are read and modified by a set of CRUD operations. The notable non-restful aspect of CMIP is the M_ACTION operation although, wherever possible, designers of management information base
Management information base
A management information base is a virtual database used for managing the entities in a communications network. Most often associated with the Simple Network Management Protocol , the term is also used more generically in contexts such as in OSI/ISO Network management model...
s (MIBs) would typically endeavour to represent controllable and stateful aspects of network equipment through attributes.
See also
- Clean URLs
- Create, read, update and delete (CRUD)
- HATEOASHATEOASHATEOAS, an abbreviation for Hypermedia as the Engine of Application State, is a constraint of the REST application architecture that distinguishes it from most other network application architectures. The principle is that a client interacts with a network application entirely through hypermedia...
(Hypermedia as the Engine of Application State) - Service-oriented architectureService-oriented architectureIn software engineering, a Service-Oriented Architecture is a set of principles and methodologies for designing and developing software in the form of interoperable services. These services are well-defined business functionalities that are built as software components that can be reused for...
- Waka (protocol)Waka (protocol)Waka is an application protocol intended as "a binary, token-based replacement for HTTP." It is "designed to match the efficiency of the REST architectural style."-History:...
External links
- RESTful Web services: The basics
- InfoQ Explores: REST
- Illustration of a self-documenting RESTful API and creation of RESTful web services through an interactive demo
- Stefan Tilkov: A Brief Introduction to REST
- Stefan Tilkov: REST Anti-Patterns
- Martin Fowler describes the Richardson Maturity Model as a way of building up an understanding of RESTful APIs
- Gregor Roth: RESTful HTTP in practice
- The REST Dialogues
- RESTwiki: a useful collection of articles about REST by some of its early proponents
- How I Explained REST to My Wife: Simple explanation of what REST is and why it's important
- Oxygen REST API A Demo REST implementation
- REST for the Rest of Us
- REST vs. SOAP at Amazon - Why 85% of the users of Amazon use REST rather than SOAP
- http://drupal.org/project/services Work with data from Drupal where Drupal act as a REST server.
- restfuse and rest-assurred – Frameworks for Java to test REST services