当前位置:网站首页>Restful specification and use
Restful specification and use
2022-04-21 08:06:00 【Fish that want to be taken away】
Restful
Simply speaking : It is the process of interaction between client and server . In this interactive process , The client wants to access the resource Resources, Resource is a noun , There are many types . This involves the process of transferring resources to the server in some form
One : Concept
REST The word , yes Roy Thomas Fielding In his 2000 Proposed in the doctoral thesis of .
Fielding Put his principles of Internet software architecture , Named REST, namely Representational State Transfer Abbreviation . Translated into Chinese is “ Represent layer state transformation ”.
that , What exactly is REST Well ? Even if translated into Chinese “ Represent layer state transformation ”, It's still hard to understand .
First , It's hard to understand , Because the previous subject has been removed . The full name should be Resource Representational State Transfer, Translated into Chinese “ Resources in the network in some form of state transition ”.
Two : characteristic
1. resources
every last URI Represents a resource
URI: Uniform resource locator
URL: Uniform resource identifiers ,http
URL stay URI Inside
So-called “ resources ”, It's an entity on the Internet , Or a specific information on the Internet . It can be a piece of text 、 A picture 、 A song 、 A service , In a word, it is a concrete reality . You can use a URI( Uniform resource locator ) Pointing to it , Each resource corresponds to a specific URI. To get this resource , Visit its URI Can , therefore URI It becomes the address or unique identifier of each resource .
So-called “ surf the internet ”, With a series of Internet “ resources ” Interaction , Call it the URI.
2. The presentation layer
Between client and server , A layer of expression that conveys this resource
“ resources ” It's an information entity , It can have many external forms . We put “ resources ” In the form of , It's called it “ The presentation layer ”(Representation).
such as , The text can be used txt Format representation , It can also be used. HTML Format 、XML Format 、JSON Format representation , It can even be in binary format . Pictures can be used JPG Format representation , It can also be used. PNG Format representation .
URI Entities that represent resources only , Does not represent its form . Strictly speaking , Some of the last ".html" Suffixes are unnecessary , Because this suffix means format , Belong to “ The presentation layer ” Category , and URI It should only represent “ resources ” The location of . Its concrete manifestation , belong HTTP The requested header information uses Accept and Content-Type Field assignment , These two fields are right “ The presentation layer ” Description of .
3. State shift
Client through four HTTP Verb , Operate on the server-side resources , Realization “ Represent layer state transformation ”.
Internet communication protocol HTTP agreement , It's a stateless protocol . It means , All States are saved on the server side . therefore , If the client wants to operate on the server , By some means , Let it happen on the server side “ State transformation ”(State Transfer). And this transformation is based on the presentation layer , So is “ Represent layer state transformation ”.
The means used by the client , Can only be HTTP agreement . say concretely , Namely HTTP In the agreement ,4 A verb indicating the mode of operation :GET、POST、PUT、DELETE. They correspond to each other 4 Basic operations :GET Used to obtain resources ,POST Used to create a new resource ( Can also be used to update resources ),PUT Used to update resources ,DELETE Used to delete resources .
3、 ... and : give an example
-
Get student resources
GET http://localhost:3000/students -
Search students
GET http://localhost:3000/students?type=name&value=" Zhang " -
according to ID Get a student
GET http://localhost:3000/sstudent/ Student id -
Add students
POST http:localhost:3000/students/ Student id -
Revise students
PUT http:localhost:3000/students/ Student id PATCH http:localhost:3000/students/ Student id -
Delete students
DELETE http:localhost:3000/students/ Student id
Four :postman Tools
Except students
DELETE http:localhost:3000/students/ Student id
Four :postman Tools

版权声明
本文为[Fish that want to be taken away]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210712347519.html
边栏推荐
- [PROJECT] small hat takeout (VI)
- 迅为STM32MP157开发板编译U-Boot
- 2022 R2 mobile pressure vessel filling test question simulation test question bank and simulation test
- Access-Control-Allow-Credentials:true 和 预检请求
- localhost和127.0.0.1有什么区别?(转载)
- Replication of Apache Solr Remote Code Execution Vulnerability (cve-2019-0193)
- 强到离谱,Transformer为何能闯入CV界秒杀CNN?
- 动态规划--LC474.一和零
- Yolov5 model environment construction and Google lab training
- You cannot set a form field before rendering a field associated with the value
猜你喜欢

Usage of go ini

Yolov5.0 calling local camera

2022 R2 mobile pressure vessel filling test question simulation test question bank and simulation test

webrtc+srs(sfu)

Capturing plaintext password with mimikatz in win10 system

作文以记之 ~ 克隆图
![[PROJECT] small hat takeout (VI)](/img/66/3ed0e0596abbf92e9111a1a0b7108c.png)
[PROJECT] small hat takeout (VI)

2022 examination question bank and simulation examination of special operation certificate for hoisting machinery command

nodeJS里面的Express架构

The interface is not restored after Fiddler changes the font
随机推荐
JS force deduction daily question (2022 / 4 / 20) --388 The longest absolute path of the file
Go编译器源代码:语法分析
It can switch the aircraft duel with three interfaces of start, battle and settlement, modularization, pyGame, rect and exe packaging
386字典序排数,学会用递归的思想
Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by serv
这是哪种插入数据库的编程语言
set集合
ThreadLocal底层分析
nodeJS里面的Express架构
VMware 16 newly installed win11 professional edition, unable to read the ISO image, unable to start the installer
Informatics Aosai yibentong 1209: score summation | openjudge 1.13 12: score summation
TIANTI race L3
可以下载到跑LOAM的数据集
2022g3 boiler water treatment examination question bank and answers
[Ethernet switching security] - explanation of port isolation operation principle and two-layer isolation and three-layer communication example configuration
Detailed explanation of burpsuite tools and examples of Library explosion
带自己学paddle(四)
C a complete class that generates Chinese amount and reads it out by voice
作文以记之 ~ 每日温度
2022年危险化学品生产单位安全生产管理人员考试模拟100题模拟考试平台操作