当前位置:网站首页>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
边栏推荐
- Openlayers draw rectangle
- Is it safe to open an account in Bohai futures.
- Installation, use and problem summary of binlog2sql tool
- Wechat applet part of the mobile phone Preview PDF did not respond
- The platinum library cannot search the debug process records of some projection devices
- Use of kotlin collaboration in the project
- 【C语言进阶11——字符和字符串函数及其模拟实现(2))】
- Tencent map and high logo removal method
- Getting started with vcpkg
- Application of DCT transform
猜你喜欢
Common SQL commands
The fifth bullet of MySQL learning -- detailed explanation of transaction and its operation characteristics
优先使用组合而不使用继承
RuntimeError: Providing a bool or integral fill value without setting the optional `dtype` or `out`
ArcMap connecting ArcGIS Server
One of the reasons why the WebView web page cannot be opened (and some WebView problem records encountered by myself)
Partage de la conception de l'alimentation électrique de commutation et illustration des compétences en conception de l'alimentation électrique
I just want to leave a note for myself
binlog2sql 工具安装使用及问题汇总
8266 obtain 18b20 temperature
随机推荐
js上传文件时控制文件类型和大小
arcgis js api dojoConfig配置
【C语言进阶11——字符和字符串函数及其模拟实现(2))】
Problems caused by flutter initialroute and home
RuntimeError: Providing a bool or integral fill value without setting the optional `dtype` or `out`
JS controls the file type and size when uploading files
JVM的类加载过程
From technical system to business insight, the closing chapter of the practice of small and medium-sized R & D team structure
SQL of contention for system time plus time in ocrale database
Openharmony open source developer growth plan, looking for new open source forces that change the world!
ArcMap连接 arcgis server
WebView saves the last browsing location
2022.04.23(LC_714_买卖股票的最佳时机含手续费)
js 计算时间差
Encyclopedia of professional terms and abbreviations in communication engineering
Codeforces Round #784 (Div. 4)
Raspberry pie uses root operation, and the graphical interface uses its own file manager
Regular expressions for judging positive integers
js获取本机ip地址
Openlayers 5.0 thermal diagram