Rest surekha

20
REST(REPRESENTATIONAL STATE TRANSFER) REST is an acronym for Representational State Transfer. REST is a style of software architecture for distributed systems such as the World Wide Web. Rest is created to serve as the guiding framework for the web protocol standard. REST can be seen as a post hoc description of the features of the World Wide Web. The original description was used to develop the HTTP/1.1 standard

description

ideal rest

Transcript of Rest surekha

Page 1: Rest surekha

REST(REPRESENTATIONAL STATE TRANSFER)

REST is an acronym for Representational State Transfer.

REST is a style of software architecture for distributed systems

such as the World Wide Web.

Rest is created to serve as the guiding framework for the web

protocol standard.

REST can be seen as a post hoc description of the features of the

World Wide Web.

The original description was used to develop the HTTP/1.1

standard

Page 2: Rest surekha

REST concept

The architecture consists of clients and servers, requests and responses.

Requests and responses are built around the transfer of representations of resources.

Clients contain representations, servers the resources (concepts) themselves.

Page 3: Rest surekha

REST concept

Client(s) Request Server

Response

(Representations) (Resources)

Page 4: Rest surekha

How REST works?

Give every “thing” an ID(URI) Link things together Use standard methods(HTTP etc) Resources with multiple representations Communicate statelessly

Page 5: Rest surekha

URI(uniform resource identifier)

Resources are referred to individually with a universal resource identifier, such as the URL used for Web addresses.

a uniform resource identifier (URI) is a string of characters used to identify a name of a web resource .

Such identification enables interaction with representations of the web resource over a network (typically the World Wide Web) using specific protocols. Schemes specifying a concrete syntax and associated protocols define each URI.

An URI identifies a resource either by location, or a name, or both. A URI has two specializations known as URL and URN.

Page 6: Rest surekha

Stateless

All requests made to connectors must contain all the information necessary to understand that request without depending on any previous request. This contrasts with the way many Web sites use cookies to maintain data between sessions. With REST, all messages must include all information necessary to understand the context of an interaction.

Page 7: Rest surekha

REST concept

A client can be either transitioning between states or be at rest.

A client is considered to be transitioning between states while one or more requests are outstanding.

The representation of the client state contains links that can be used to initiate new state transitions.

Page 8: Rest surekha

REST concept

A client in a rest state is able to interact with its user.

A client at rest creates no load on the servers or the network.

A client at rest consumes no per-client storage on the servers.

Page 9: Rest surekha

REST constraints

The REST architecture describes the following six

constraints to implement this concept:• Client-server• Stateless• Cacheable• Uniform interface• Layered system• Code on demand [optional]

Page 10: Rest surekha

Client-server

Clients are separated from servers by a uniform interface. So we have a separation of concerns:

– Clients are concerned with the presentation to the user and the application state

– Servers are concerned with data storage, domain model logic etc.

improves UI portability

simplifies server

enables multiple organizational domains

Page 11: Rest surekha

Stateless

No client context is stored on the server between requests.

Each request from any client contains all of the information necessary to service the request, and any 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.

Page 12: Rest surekha

simplifies server improves scalability improves reliability

Page 13: Rest surekha

Cacheable

Clients are able to cache responses. Responses must, implicitly or explicitly,

define themselves as cacheable or not. reduces average latency + improves efficiency + improves scalability

Page 14: Rest surekha

Uniform interface

A uniform interface between clients and servers

simplifies and decouples the architecture.

This enables each part to evolve independently.

Page 15: Rest surekha

Layered system

A client cannot ordinarily tell whether it is connected directly to the end server, or to an intermediary along the way.

Layers providing load balancing, security or shared caching can be added or removed very easily this way.

simplifies clients + shared caching + improves scalability + legacy encapsulation + load balancing

Page 16: Rest surekha

Code on demand (optional)

Servers are able temporarily to 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.

Page 17: Rest surekha

Advantages

With RESTful design, Web services can be seen as simply a means of publishing information, components and processes to make them accessible to other users and machine processes.

REST requires less client-side software than do other approaches, because a single, standard browser can access any application and data resource.

Page 18: Rest surekha

Offers possibilities for thin client development as less client code is required.

Does not require explicit resource discovery mechanism due to hyperlinking.

Scalable architecture compared with those that require stateful servers.

Caching promotes network efficiency and fast response times.

Software versioning benefits including support of document type evolution such as HTML and XML without impacting backward or forward compatibility.

Resource extensibility, allowing support for new content types without impacting existing and legacy content types.

Page 19: Rest surekha

Disadvantages

HTTP as a uniform interface presents technical challenges for real time asynchronous events to a thin client or browser based application.

Managing URI Namespace can be cumbersome.

Lacks supporting software tools Can impact network performance by

encouraging more frequent client-server requests and responses.

Page 20: Rest surekha

some major brands using REST