当前位置:网站首页>What is restful verb
What is restful verb
2022-07-23 23:53:00 【InfoQ】
REST Verbs specify the actions to be performed on a particular resource or collection of resources . When the client makes a request , It should be in HTTP Send the following information in the request :
- REST Verb
- Header information
- The main body ( Optional )
REST Use URI To decode the resources to be processed . There are many available REST Verb , But six of them are often used . They are as follows :
GET
POST
PUT
PATCH
DELETE
OPTIONS
If you are a software developer , Then you will deal with these six problems most of the time . The following table describes the operation 、 Target resources and what happens when the request succeeds or fails :
The numbers in the success and failure columns of the above table are HTTP The status code . Whenever the client starts REST In operation , Rest is stateless , The customer should know whether the operation method is successful . therefore ,HTTP Status code with response .RET Define the previous status code type for a given operation . It means REST API The previous rules should be strictly followed to implement the client - Server communication .
All defined REST Services have the following format . It consists of the host and API End point composition . API The endpoint is predefined by the server URL route . Every REST All requests should reach this path .
REST API URI:
http://HostName/API endpoint/Query(optional) Let's look at all verbs in more detail .REST API Design begins with the definition of operations and API Endpoint . In the realization of API Before , The design documentation should list all endpoints for a given resource . In the following sections , We carefully observe the use PayPal Of REST API As a use case REST API Endpoint .
GET Method
GET Method to get the given resource from the server . To specify a resource ,GET Several types of URI Inquire about :
- Query parameters
- Path based parameters
If you don't know , All your browsing of the network is performed through the server Get Request to complete . for example , If you type www.google.com, Is actually to get the search page GET request . ad locum , Your browser is a client ,Google Of Web Server is Web The back-end implementer of the service . The success of Get Operation return 200 A status code .
Examples of path parameters :
Everybody knows that PayPal.PayPal Create a settlement agreement with the company . If you register PayPal Payment system of , They provide you REST API, To meet all your billing needs . The example request to obtain settlement agreement information is as follows :
/v1/payments/billing-agreements/agreement_id.
边栏推荐
猜你喜欢
随机推荐
DGS file upload
北大青鸟昌平校区:运维就业现状怎么样?技能要求高吗?
ciscn_2019_n_8
day2
[第五空间2019 决赛]PWN5
Notes on cmake compilation tool
warmup_ csaw_ two thousand and sixteen
C # introductory series (XXVIII) -- query syntax of LINQ
Solidity-delegateCall插槽冲突分析与解决
[SSM]前后台协议联调①
Qt创建窗口被阻塞不能及时显示的问题
ciscn_ 2019_ n_ eight
Copy the customer service wechat, go to wechat to add, and make a call
pthread 的 joinable 和 detached
pwn1_ sctf_ two thousand and sixteen
第六章、实现一个持久性适配器
网络安全课堂作业
[CTF] Tiange team writeup - the first digital space security attack and defense competition (Preliminary)
DGS之N+1选择问题
473-82(40、662、31、98、189)


![最长递增子序列变种[深刻理解最长递增序列]](/img/73/1480ec319a2860fec5667d6f2fb2ba.png)


![[redis] redis installation and client redis cli use (batch operation)](/img/d7/7500e99bc3cf172f895a47aec0b44c.png)
![[ssm] joint debugging of front and rear protocols ①](/img/47/c1016c5c5e4ffc0d6cc93cf50d52df.png)


