当前位置:网站首页>Core concepts of rest
Core concepts of rest
2022-04-23 19:14:00 【Li Siwei】
REST(Representational State Transfer, Declarative state transitions )
resources
Every standard URL Can uniquely locate web A resource on the server .
When sending HTTP GET When asked , adopt URL To indicate where the resource to be requested is web Where on the server .
Resource expression
When web The client sends HTTP GET After the request , The server responds to the main content of the client , Is the expression of resources .
Every URL The resource being located is unique , However, the expression of resources can be diverse .
for example , For the information of a student stored on the server , The data can be filled into a beautiful... Designed by us HTML On the page , It can also be directly provided to the client for download in the form of plain text file .HTML And text files are different representations of the same resource .
Resource state
For the same URL, Send... At different points in time HTTP GET request , The response of the subject is likely to be different .
for example : At the beginning of class 1 of junior high school, there was 25 A student , The information of these students is managed through the student information management system , If we send a list of all students in class 1 at the beginning of school HTTP GET request , We will get 25 Bar record .
But three weeks after school , A student transferred in and joined class one of grade one , The student's information is also managed into the system . Then we send another URL Exactly the same HTTP GET request , The results are really different : Now the response body contains 26 Student records .
URL Exactly the same , In other words, it is a request for the same resource , But at different points in time , This resource has different states .
Declarative state transitions
The same resource has different states at different time points , When is the state of this resource 、 How did the transfer happen .
The answer is : Three weeks after the start of school, when new students transfer in , Its information is submitted to the management system , At this time , There is one HTTP POST The request is sent to the student information management system server , This request is to submit the information of new students to the system . It's this POST request , Changed the “ Information list of students in class 1 of junior high school ” The state of this resource .
“ Information list of students in class 1 of junior high school ” The state transition of this resource , Is written by a HTTP POST The request resulted in , And this POST Where does the main content of the request come from ? Is submitted from the client HTML Forms , This HTML The form is for the information of newly transferred students HTML describe , That is, the client sends a statement to the server —— New classmate's HTML The form changes the state of the resource ( Transfer )
REST Is a collection of design constraints
REST It's not an agreement 、 Nor is it a development framework , It's a collection of design constraints : No state 、 Using hypermedia as an application state engine .
版权声明
本文为[Li Siwei]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210600381220.html
边栏推荐
- mysql_ Download and installation of Linux version
- MySQL学习第五弹——事务及其操作特性详解
- 2021-2022-2 ACM集训队每周程序设计竞赛(8)题解
- js 计算时间差
- Tencent cloud GPU best practices - remote development training using jupyter pycharm
- Disable Ctrl + Alt + Del
- C1000k TCP connection upper limit test
- Why is PostgreSQL about to surpass SQL Server?
- C1000k TCP connection upper limit test 1
- C: generic reflection
猜你喜欢

简化路径(力扣71)

Android Development: the client obtains the latest value in the database in real time and displays it on the interface

I just want to leave a note for myself

Wechat video extraction and receiving file path

JVM的类加载过程

12个例子夯实promise基础

12 examples to consolidate promise Foundation

Wechat applet part of the mobile phone Preview PDF did not respond

MySQL学习第五弹——事务及其操作特性详解

Why is PostgreSQL about to surpass SQL Server?
随机推荐
SQL of contention for system time plus time in ocrale database
std::stoi stol stoul stoll stof stod
Strange passion
White screen processing method of fulter startup page
Use of kotlin collaboration in the project
Minesweeping II of souI instance
Openlayers 5.0 two centering methods
Matlab 2019 installation of deep learning toolbox model for googlenet network
Speculation on the way to realize the smooth drag preview of video editing software
From technical system to business insight, the closing chapter of the practice of small and medium-sized R & D team structure
SSDB foundation 2
Tencent map and high logo removal method
static类变量快速入门
Redis common interview questions
SSDB Foundation
浅谈c语言指针的强制转换
Regular expressions for judging positive integers
js 计算时间差
RuntimeError: Providing a bool or integral fill value without setting the optional `dtype` or `out`
c#:泛型反射