What is the rest API?

Source: Internet
Author: User
Tags representational state transfer

Rest refers to a set of schema constraints and principles that meet constraints and principles of application design.
Architecture, the software architecture is divided into three parts: building, describing a computer, a connector that describes the link part of the build, and a configuration that makes the build and connector an organic whole.
Basic Web technologies:
URI (Uniform Resource Identifier) HTTP (Hypertext Transfer Protocol) (post, get, put, delete)
Hypertext.
1. Each resource should have a unique identity
2. Change the state of a resource using a standard method
3, request and response self-description
4. Multiple representations of resources
5. Stateless Service Rest API Development Learning Notes Overview

REST is looking at the entire network from a resource perspective, where resources are determined by URIs, and the client's application uses URIs to get a representation of the resource. Obtaining these features has led to these applications transforming their state. As the resources are constantly being represented, the client application is constantly transforming its state, the so-called representational state transfer (representational, 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. ”

Rest is a design style, not 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.

A resource is specified by a 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 their representations.
The expression of a resource 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.
Requirements for rest
Client and server architecture
The connection protocol has no State
Ability to use the cache mechanism to improve performance
Hierarchical system
On-Demand code-JAVASCRIPT (optional)

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: URIs, such as: http://example.com/resources/.

§web Service accepts and returns the type of Internet media, such as: Json,xml, YAML, etc.

The §web service supports a range of request methods (for example, post,get,put or delete) on this resource.

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

Resources
GET
PUT
POST
DELETE

A URI for a set of resources, such as http://example.com/resources/
Lists the URI, along with the details of each resource in the 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, in the form of an appropriate network media type (e.g. XML, JSON, etc.)
Replace/create the specified resource. 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. This is because rest is a schema, and soap is just a protocol. While rest is not a standard, there are various other criteria (such as http,url,xml,png, etc.) that 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 as a client to simplify software requirements
Rest has less software dependencies than other mechanisms superimposed on the HTTP protocol
No additional resource discovery mechanism required
Long-term compatibility in the evolution of software technology is better

What is the rest API?

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.