What is restful
If an architecture conforms to REST principles, it is called a RESTful architecture.
#RESTful API is practical in how to correctly understand the RESTful architecture and design a RESTful API. First of all, why use RESTful structure? Everyone knows that "ancient" web pages are a combination of front-end and back-end, such as the previous PHP, JSP, etc. There was not much of a problem in the previous desktop era, but with the development of mobile Internet in recent years, various types of Clients have emerged one after another. RESTful can provide services for Web, iOS and Android through a unified set of interfaces. In addition, for the majority of platforms, such as Facebook platform, Weibo open platform, WeChat public platform, etc., they do not need an explicit front end, they only need a set of interfaces to provide services, so RESTful is their best choice. Under the RESTful architecture:
Let’s talk about the REST name first
First of all, it is obscure because the previous subject has been removed. The full name is Resource Representational State Transfer: In layman's terms, it means: resources transfer state in a certain form of expression in the network. Break it down:
Resource: Resource, that is, data (as mentioned before, the core of the network). For example, newsfeed, friends, etc.;
Representational: some form of expression, such as JSON, XML, JPEG, etc.;
State Transfer: state change. Implemented via HTTP verbs.
REST’s sourceRoy Fielding’s graduation thesis. This guy participated in the design of the HTTP protocol and is also the co-founder of the Apache Web Server project (unfortunately, it is now dominated by nginx). The PhD school I graduated from is UC Irvine. Irvine is in California, a famous wealthy area with abundant sunshine and beautiful beaches. The headquarters of Oculus VR is located here (virtual reality glasses, acquired by FB, CTO is John Carmack, the author of Quake and Doom).
It is well known that papers are obscure and difficult to understand. When I was studying at CMU, many courses would arrange paper review twice a week. Looking back now, every time I write a paper review, it is the most painful time for me. This doctoral thesis on REST is undoubtedly even better.
Overview
Based on the above explanation, let’s summarize what is RESTful architecture: (1) Each URI represents a resource; (2) A certain presentation layer of this resource is transferred between the client and the server; (3) The client operates the server-side resources through four HTTP verbs to achieve "Presentation layer state transformation".The above is the detailed content of What is restful?. For more information, please follow other related articles on the PHP Chinese website!