REST is an abbreviation for Representationalstatetransfer, which is generally translated as "representational state transfer", and Roy Thomas Fielding invented the concept in his 2000 PhD dissertation. The first thing you need to know is that rest is not a specification or a concrete framework, it describes a few "constraints" when building Web applications, which can help us build better Web applications.
These constraints include:
- client–server client and server separation, client responsible for state maintenance/rendering the latter is responsible for business/storage
- stateless server does not maintain application state, each request contains enough information to request data
- cacheable data can be cached, the response can be explicitly or implicitly specify whether the data can be cached
- Layered System clients do not need to know whether to communicate directly with the server, in the middle may have such as load balancing
- Code On Demand (optional) server side can temporarily extend the functionality of the client, such as JavaScript
- The constraints of the Uniform interface Unified interface are the basis for all design rest services, and it also contains several aspects.
About Uniform interface contains the following aspects:
- Identification of resources resource identification, presentation of resources and actual form separation of resources, such as using XML or JSON to express resources and internal servers may use the database to store resources
- Manipulation of resources through these representations resource contains sufficient meta data to manipulate resources
- self-descriptive messages Each message contains enough meta-information to describe how it was consumed
- Hypermedia as the engine of application state (HATEOAS) This is a bit complicated!!
What is the RESTful API?