What is RESTful architecture

 

To understand the REST architecture, the application must know the background: "Internet software", both now most software programmers, are running on the Internet, it is based on the "server / client (server / client)" mode It is having: high latency, high concurrency. And how to develop the use of the Internet environment software (efficient, unified allow client access server) is the purpose of RESTful architecture, it is a clear structure, standards-compliant, easy to understand, easy to expand.

In the end what is RESTful architecture?

REST (Representational State Transfer) of the acronym. "Presentation layer state transformation." If a framework in line with the principles of REST, call it RESTful architecture. REST Name "performance layer state transformation", the subject is omitted. "Presentation layer" actually refers to the "resource" (Resources) of the "presentation layer."

 REST is described in the form of an interactive network of client and server (how better software in a network application); REST itself is not practical and useful is how to design RESTful API (REST-style network interface);

Resources (Resources)

REST Name "performance layer state transformation", the subject is omitted. "Presentation layer" actually refers to the "resource" (Resources) of the "presentation layer."

The so-called "resource" is an entity on the network, or is a specific information on the network. It can be a piece of text, a picture, a song, a service, in short, is a concrete reality. You can point to it with a URI (uniform resource locator), each of which corresponds to a specific resource URI. To obtain this resource, you can access its URI, URI therefore became address or a unique identifier for each resource.

The so-called "Internet" is a series of interactions with the Internet "resources", calling its URI.

Fourth, the presentation layer (Representation)

"Resources" is an information entity, it can have a variety of external manifestation. We are the "Resources" presented in the form of concrete, called it the "presentation layer" (Representation).

For example, you can use the text format txt performance, you can also use HTML format, XML format, JSON format performance, even in binary format; JPG format images can show, you can also use PNG format performance.

URI represent physical resources, and does not represent its form. Strictly speaking, some URL after ".html" extension is unnecessary, because the suffix representation format, belongs to the category "presentation layer" and the URI should represent the position of "resources". Its specific forms, and should Accept field specifies the Content-Type header of HTTP request with the two fields is a description of the "performance layer".

Fifth, the state transformation (State Transfer)

Visit a website, an interactive process on behalf of the client and the server. In the process, inevitably it involves changes in the data and status.

Internet communication protocol HTTP protocol is a stateless protocol. This means that all the states are stored on the server side. Therefore, if the client wants to operate the server, must by some means, let the server take place "state transformation" (State Transfer). And this transformation is based on the presentation layer, so is the "presentation layer state transformation."

The means used by the client, only the HTTP protocol. Specifically, it is inside the HTTP protocol, four verb indicates the operation mode: GET, POST, PUT, DELETE. Which correspond to the four basic operations: GET used to obtain resources, POST for new resources (can also be used to update the resource), PUT for updating resources, DELETE to delete the resource.

RESTful API Server provided, URL used only to specify the terms of resources, in principle, the use of verbs. "Resources" are the core REST architecture or the entire network processing.

VI Summary

Integrated the above explanation, we summarize what is RESTful architecture:

  (1) each represents a URI resource;

  (2) between the client and the server, and transmission resources in such a manner that some form of display presentation layer;

  (3) by four HTTP verbs client, server-side resources operate to achieve "the state of the presentation layer transformation."

Indicate the reference :( http://www.ruanyifeng.com/blog/2011/09/restful.html )

Published 28 original articles · won praise 10 · views 10000 +

Guess you like

Origin blog.csdn.net/yht18330690553/article/details/104056538