RESTful API is a REST-style API, which is a set of protocols used to standardize the interaction between multiple forms of front-ends and the same backend. The RESTful API is called by the front-end provided by the back-end, that is, SERVER; the front-end calls the API to initiate an HTTP request to the back-end, and the back-end responds to the request and feeds back the processing results to the front-end.
If you want to know what RESTful api is, you must first know what REST is.
REST (English: REpresentational State Transfer, abbreviated as REST) describes an architectural style network system, which refers to a set of architectural constraints and principles. However, an application or design that satisfies these constraints and principles is RESTful.
The literal translation of REST in English is "presentation layer state transfer". If you look at this concept, it is estimated that not many people will understand what it means. Let me explain what RESTful is in human words: URL locates resources and uses HTTP verbs (GET, POST, PUT, DELETE) to describe operations.
Resource: Resource, that is, data.
Representational: Some form of representation, such as JSON, XML, JPEG, etc.;
State Transfer: State change. Implemented via HTTP verbs.
So RESTful API is a REST style API.
So in what scenarios is RESTful API used?
There are many front-end display media in today’s Internet applications. There are mobile phones, tablets, PCs and other display media. Then it is definitely the most scientific and economical way to process the user requests received by these front-ends in a unified backend and return them to different front-ends. RESTful API is a set of protocols to standardize the interaction between multiple forms of front-end and the same back-end. The RESTful API is called by the backend, that is, the SERVER, which provides the frontend. The front end calls the API to initiate an HTTP request to the backend, and the backend responds to the request and feeds back the processing results to the front end.
The above is the detailed content of What is restful api?. For more information, please follow other related articles on the PHP Chinese website!