一、路径参数:用于标识资源的URL唯一标识符或标识特定资源的属性
https://api.example.com/users/{userID}
//路径参数拼接
1.
export const delete = (id) =>
defHttp.delete({ url: '/rscheck/v1/person/checkpersonmsg/' + id });
2.
export const delete = (id) =>
defHttp.delete({ url: `/rscheck/v1/person/checkpersonmsg/${id}` });
//其中,id就是路径参数
二、查询参数:查询参数是在 URL 中通过
?
后面附加的键值对形式传递的,不同参数之间使用&
连接
https://api.example.com/search?query=term&page=1&limit=10
export const delete = (params) =>
defHttp.delete({ url: '/rscheck/v1/person/checkpersonmsg/delete',params });
//其中,params就是查询参数
三、请求头参数(Request Headers): 包含在HTTP请求头部中,用于传递额外的信息,例如授权信息、内容类型等
GET /api/resource HTTP/1.1
Host: example.com
Authorization: Bearer your_access_token
Content-Type: application/json
四、请求体参数(Request Body): 包含在HTTP请求体中,通常用于POST、PUT等请求方法,传递客户端向服务器提交的数据
POST /api/resource HTTP/1.1
Host: example.com
Content-Type: application/json
{
"key": "value"
}
五、响应头参数(Response Headers): 包含在HTTP响应头部中,用于传递响应的元数据,例如内容类型、缓存控制等
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-cache
六、响应体参数(Response Body): 包含在HTTP响应体中,传递服务器对请求的响应数据
HTTP/1.1 200 OK
Content-Type: application/json
{
"result": "success"
}
七、授权参数(Authentication Parameters): 用于身份验证,例如用户名、密码、访问令牌等
GET /api/resource HTTP/1.1
Host: example.com
Authorization: Basic base64encoded(username:password)