What is REST?

Source: Internet
Author: User

What is REST?

Restful

REST (Representation State Transfer) ful is fulfil (fulfillment, fulfillment, completion, fulfillment, fulfillment, practice )

REST is designed based on named Resources-for example, in the form of Uniform Resource Locators (URL), Uniform Resource Identifiers (URI), and Uniform Resource Names (URN)-While A style of non-messaging loosely-coupled Web applications. REST cleverly draws on the proven successful WEB infrastructure-http. In other words, REST takes advantage of certain aspects of the HTTP protocol, such as GET and POST requests. These requests can be well mapped to standard business application requirements such as Create, read, update, and delete (CRUD), as shown in table 1:

Table 1. Crud/http Mapping
Application Tasks HTTP Command
Create POST
Read GET
Update PUT
Delete DELETE

The request is like a verb, and the resource is like a noun, and the correlation between the two forms the logical expression of the act-for example, GET the document, the DELETE record.

The true rest father, Roy Fielding, stated in his doctoral dissertation that rest "emphasizes the scalability of component interactions, the universality of interfaces, standalone deployment components, and the use of intermediate components to reduce interaction latency, enhance security, and encapsulate legacy systems" (see Resources). Building a RESTful system is not difficult, and such a system is highly scalable and loosely coupled to the underlying data, which can also make good use of caching.

Everything on the Web (pages, images, etc.) is essentially a resource. REST is based on named resources rather than messages, which limits the exposure of the underlying technology and provides a convenient condition for loose coupling in application design. For example, the following URL exposes a resource without implying any underlying technology: http://thediscoblog.com/2008/03/20/unambiguously-analyzing-metrics/.

The URL represents a resource-an article called "Unambiguously analyzing metrics". The HTTP command is invoked when the resource is requested GET . Note that the URL is based on a noun. A verb-based version (presumably similar to http://thediscoblog.com/2008/03/20/getArticle?name=unambiguously-analyzing-metrics) would violate the REST principle because it A message is nested in the form of a getArticle. You can also envision POST a command to publish a new resource via HTTP (for example, an article such as http://thediscoblog.com/2008/03/22/rest-is-good-for-you/). You can also envision the use of associated, verb-based api-such as Createarticle?name=rest-is-good-for-you and deletearticle?name=rest-is-good-for-you- Such a call to intercept HTTP GET commands and to minimize the existing (and successful) HTTP infrastructure. In other words, they are not RESTful styles.

The beauty of REST is that anything can be a resource, and the means can be different. In the previous example, the resource is an HTML file, so its response may be in HTML format. But a resource can also be an XML document, a serialized object, or a JSON representation. In fact, none of this matters. It is important that the resource is named and that communication with it does not affect its state. It is important not to affect the state, because stateless interactions are advantageous for scalability.

Where is the value of it?

Quoting Leonardo da Vinci's famous saying "simplicity is the ultimate complication". The implementation of the World Wide Web is very simple and has no place to succeed. REST is taking advantage of the simplicity of the Web, and thus creating a highly scalable, loosely coupled system, and it turns out that such a system is easy to build.

As you can see, the hardest part of building a RESTful application is determining which resources to expose. After solving this problem, it is a piece of cake to build a RESTful Web service using the Open source Restlet framework.

Http://www.ibm.com/developerworks/cn/education/java/j-rest/j-rest.html

What is REST?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.