Some understanding of rest

Source: Internet
Author: User
Tags representational state transfer

Yesterday study rest, found an article written really good, read it again, and did not fully understand, will some feel more important to do a record. Article link:Rest Introduction

Defined

Representational state Transfer (REST) was a software architecture style consisting of guidelines and best practices for CR Eating scalable Web services. REST is a coordinated set of constraints applied to the design of the. A distributed hypermedia system that can L EAD to a more performant and maintainable architecture.

Explain briefly (personal understanding, not necessarily accurate):
(1) Rest:representational State Transfer, performance status transmission.
(2) Rest is a software architecture style and a best practice and guideline for building scalable Web services.
(3) Rest is a set of software-building constraints, and the goal is to create a well-scaled distributed system.

Constraints

Rest presents a series of schema-level constraints, extracted as follows:
1. Use the client/server model. A unified interface between the client and the server communicates with each other.
2, the hierarchical system. In a rest system, the client does not deal with a server in a fixed way.
3, no state. In a rest system, the server does not save any state about the customer. In other words, the client itself is responsible for maintaining the state of the user and needs to provide sufficient information each time the request is sent.
4, can be cached. The rest system needs to be able to properly cache requests to minimize the transfer of information between the server and the client to improve performance.
5, the Unified interface. A rest system needs to use a unified interface to complete the interaction between subsystems and between services and users. This allows individual subsystems in the rest system to evolve independently.
(1) Each resource has a resource identifier. The resource identifier for each resource can be used to uniquely identify the resource.
(2) The self-descriptive nature of the message. The messages that are passed in the rest system need to be able to provide enough information about how they are handled. For example, the MIME type used by the message, whether it can be cached, and so on.
(3) The self-descriptive nature of the resource. The resources returned by a rest system need to be able to describe itself and provide enough information to manipulate the resource, such as how to add, delete, and modify the resource. That is, a typical rest service does not require additional documentation to describe how resources are manipulated.
(4) HATEOAS. That is, the customer can only get the information that is needed for the next operation through the information contained in the results returned by the server, such as which URL to send the request to. That is, a typical rest service does not require additional documentation on which URLs to access a particular type of resource, but rather the response that is returned by the server to indicate exactly what action can be performed on that resource. A Rest service client does not need to know any information about what resources are available.

Personal understanding

1. Why do I need rest? In order to support high concurrent access, stand-alone applications must not, need a distributed system, how to build a well-extended distributed system? You need rest.
2, what is it? Not new technologies, technology is old, but there are many ways to use technology. Rest is telling you to do what I say, to build a more scalable distributed system.
3, no State. When the previous software was built, the user state (such as login information) exists on the server, that is, the session, single-machine application is not a problem, but to cluster, session synchronization is a big problem. Now the unified Convention, the server does not exist, the state information about what to do? Each time the client accesses it, that is, the client itself is responsible for maintaining the state of the user and is required to provide sufficient information each time the request is sent. Perhaps this is the literal meaning of rest, the expression of state transmission.
4, design ideas change. When traditional software is built, consider what kind of logic is handled within the server when a request is made. Rest is a resource to consider, what resources to provide, and what to do with the resources. A bit similar to the idea of process-oriented programming and object-oriented programming transformation.

Some understanding of 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.