Difference between revisions of "Representational State Transfer (REST)"

From EBA_Documentation
Jump to: navigation, search
(Created page with "=Definition= Representational State Transfer (REST) is the software architecture of the Internet. It defines a series of protocols and constraints so all web services can fun...")
(No difference)

Revision as of 14:57, 9 February 2016


Representational State Transfer (REST) is the software architecture of the Internet. It defines a series of protocols and constraints so all web services can function together.

REST Applied to web services

Web service APIs that adhere to the REST architectural constraints are called RESTful APIs. HTTP-based RESTful APIs are defined with the following aspects:

an Internet media type for the data. This is often JSON but can be any other valid Internet media type (e.g., XML, Atom, microformats, etc.)

  • standard HTTP methods (e.g., OPTIONS, GET, PUT, POST, or DELETE)
  • hypertext links to reference state
  • hypertext links to reference-related resources[10]

Constraints Defined

The formal RESTful constraints are as follows (abridged from Wikipedia):

Client–server A uniform interface separates clients from servers. This separation of concerns means that, for example, clients are not concerned with data storage. Servers are not concerned with the user interface or user state, so that servers can be simpler and more scalable.


Each request from any client contains all the information necessary to service the request, and session state is held in the client. The session state can be transferred by the server to another service such as a database to maintain a persistent state for a period and allow authentication. 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.


As on the World Wide Web, clients and intermediaries can cache responses. Responses must therefore, implicitly or explicitly, define themselves as cacheable, or not, to prevent clients from 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 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)

Servers can temporarily extend or customize the functionality of a client by the transfer of executable code. Examples of this may include compiled components such as Java applets and client-side scripts such as JavaScript. "Code on demand" is the only optional constraint of the REST architecture.

Uniform interface

The uniform interface constraint is fundamental to the design of any REST service.[4] The uniform interface simplifies and decouples the architecture, which enables each part to evolve independently. The four constraints for this uniform interface are

  • Identification of resources
  • Manipulation of resources through these representations
  • Self-descriptive messages
  • Hypermedia as the engine of application state (HATEOAS)