请求接口:http://xx.xx.xx.xx/api/user/stu_info
请求参数:stu_name
请求参数是放在请求 URL 里的,点击 Params
添加参数,key 输入参数名stu_name
,value 输入参数的值如 test1
请求接口:http://xx.xx.xx.xx/api/user/login
请求参数:username
、passwd
参数是放在 body 里的,body 里选择 form-data 的数据格式,添加 username
、passwd
参数:
请求接口:http://xx.xx.xx.xx/api/user/add_stu
请求参数:json
类型的数据,格式如下:
{
"name":"把啦啦啦",
"grade":"金牛座",
"phone":18564567890,
"sex":"女",
"age": 999,
"addr": "浙江杭州"
}
postman 里切换到 Body 里选择 json 的数据格式,填写参数内容:
请求接口:http://xx.xx.xx.xx/api/user/gold_add
请求参数:需要添加 cookie 才能操作, cookie 中 key 为用户名, value 为用户登录返回的 session。
postman 中 cookie 在 header 里添加,如图:
请求接口:http://xx.xx.xx.xx/api/user/all_stu
请求参数:带有 header,header 名为Referer
, 值为http://api.nnzhp.cn/
请求接口:http://xx.xx.xx.xx/api/file/file_upload
请求参数:一个文件
postman 里 Body 数据格式选择 form-data,参数类型选择 File,然后就可以进行文件上传的操作了,如图:
原文:https://www.cnblogs.com/mayytest1202/p/9692298.html