Thursday, October 20, 2011

REST(REpresentation State Transfer)

What is REST?
REST ( REpresentation State Transfer ) described an architecture style of network system, such as web application program. It first appeared in 2000 in Roy Fielding 's doctoral thesis, he is one of the main writing HTTP code.
REST refers to a group of schema constraint conditions and principles. To satisfy these constraints and the principles of the application or design is RESTful.
The Web application REST principle is the most important, the client and server interaction between requests is in no state. From the client to the server on each request must contain the information necessary to understand the request. If the server to request any time between point restart, the client will not be notified. In addition, no status request can be made of any available server response, which is very suitable for such as cloud computing environment. The client can cache data to improve performance.
In the server, the application status and function can be divided into various resources. Resource is an interesting concept entity, it is exposed to the client. Resource examples are : application objects, database records, algorithm and so on. Each resource using the URI ( Universal Resource Identifier ) have a unique IP address. All the resources share a common interface, so that the transmitted between a client and a server status. Using a standard HTTP methods, such as GET, PUT, POST and DELETE. Hypermedia is the application state of the engine, expressed through hyperlinks Internet resources.
Another important principle of REST is a hierarchical system, the said components don't understand how it interacts with the intermediate layer outside the assembly. Through the system knowledge limited to a single layer, can limit the complexity in the whole system, promote the underlying independence.
When the REST schema constraint condition as a whole when applied, will generate a can be extended to a large number of client application program. It also reduces the interaction between client and server delay. The unified interface simplifies the architecture of the system, improved the system of interaction between visibility. REST simplifies the client and server to achieve.
Implementation of RESTful: RESTful Web service and RPC style Web service
Understand what is REST, we'll have a look RESTful realization. Recently, the use of RPC style structure constructed based on the SOAP Web service has become the most commonly used method to achieve SOA. RPC style Web Services client will be one filled with data envelope ( including method and parameter information ) through HTTP sent to the server. Server open the envelope and the use of parameters specified method. Method results in packaged into an envelope and as a response back to the client. The client receives the response and opens the envelope. Each object has its own unique methods and only open a URI RPC style Web services, URI represents a single endpoint. It ignores most of HTTP's characteristics and only supports POST method.
Due to the lightweight and directly through HTTP data transmission characteristics, Web service of the RESTful method has become one of the most common alternative. You can use a variety of languages ( such as Java, Perl, Ruby program, Python, PHP and Javascript [ Ajax ] ) to achieve the client. The RESTful Web service can usually through automatic client or on behalf of the user applications to access. However, this service is simple to allow the user to directly interact with the Web browser, using them to construct a GET URL and read the content returned.
In the REST Web style service, each resource has an address. The resource itself is a method call, list of methods to all resources are the same. These methods are standard methods, including HTTP GET, POST, PUT, DELETE, may also include HEADER and OPTIONS.
In the RPC style architecture, the attention is paid to the method, while the REST style architecture, the attention is paid to the resource -- will use the standard method for retrieving and operating information fragment (using the said form). Resource representation in the form of representation of the use of hyperlinks interconnection.
Leonard Richardson and Sam Ruby in their book RESTful Web Services introduced the term REST-RPC hybrid architecture. REST-RPC mixed Web services without the use of the packaging envelope method, parameters and data, but directly through the HTTP transmission data, which with the REST style Web service is similar to. But it does not use the standard HTTP method of operating resources. It is in the HTTP request as part of the URI storage method information. Several well-known Web services, such as Yahoo Flickr API and del Icio us API use the hybrid architecture.

No comments:

Post a Comment