Rest Introduction-From Wiki

Source: Internet
Author: User
Tags http request soap json web services
Rest: Representational state transitions, representational states Transfer, short rest

Purpose:
REST observes the entire network from the perspective of resources, where resources are determined by URIs, and the client's application obtains a table of resources through URIs. Obtaining these forms causes these applications to transform their state. As the form of the resource is continuously acquired, the client application constantly transforms its state, the so-called Representational state Transition (Transfer).

This view is not figment, but is abstracted by observing the way the Web Internet works today. Roy Fielding believes that
"Well-designed Web applications are represented as a series of web pages that can be viewed as virtual state machines, where the user chooses these links to cause the next page to be transmitted to the user for presentation to the users, and this represents a change in state. ”

Key points and standards:
It is important to note that rest is a design style rather than a standard. Rest is often based on the use of Http,uri, and XML as well as the HTML of these existing widely popular protocols and standards.

* Resources are specified by URI.
* Operations on resources include acquiring, creating, modifying, and deleting resources that correspond exactly to the get, POST, put, and Delete methods provided by the HTTP protocol.
* Manipulate resources by manipulating the table shape of the resource.
* The presentation of resources is either XML or HTML, depending on whether the reader is a machine or a person, a client software that consumes a Web service, or a Web browser. Of course it can be any other format

RESTful Web Services

A RESTful Web service (also known as the RESTful web API) is a Web service that uses HTTP and follows the rest principle. It is defined from the following three resources:

* URI, for example: http://example.com/resources/.
* Web Services accept and return the Internet media type, such as: Json,xml, YAML, etc.
* A series of request methods supported by the Web service on this resource (e.g., post,get,put or delete).

This table lists the typical uses of the HTTP request method when implementing a restful Web service.
Typical application of the HTTP request method in restful WEB services [1] resource GET PUT POST DELETE
A URI for a set of resources, such as http://example.com/resources/, which lists the URI, and the details of each resource in that resource group (the latter is optional).     Replaces the current entire set of resources with a given set of resources. Create/Append a new resource in this group of resources.     This operation often returns the URL of the new resource. Deletes the entire set of resources.
A URI for a single resource, such as http://example.com/resources/142 gets the details of the specified resource, which can be replaced/created with a suitable network media type (e.g. XML, JSON, etc.).     and append it to the appropriate resource group.     The specified resource is treated as a resource group and under which a new element is created/appended to be subordinate to the current resource. Deletes the specified element.

The PUT and DELETE methods are idempotent. The Get method is a security method (it is not modified on the server side and is therefore idempotent).

Unlike SOAP-based Web services, RESTful Web services do not have a "formal" standard [2]. This is because rest is a schema, and soap is just a protocol. While rest is not a standard, other standards (such as http,url,xml,png, etc.) can be used when implementing restful Web services

Benefits of rest

* Cache caches can be used to improve response speed
* The stateless nature of the communication itself allows different servers to process different requests in a series of requests, increasing the scalability of the server
* Browser can be used as a client to simplify software requirements
* Rest software is less dependent than other mechanisms superimposed on HTTP protocols
* No additional resource discovery mechanism required
* Long-term compatibility in software technology evolution is better



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.