Postman调用http接口如何设置

输入HTTP URL
1,Authorization里面有 Type,我们的远程接口由于采用的是
HTTP Basic Authentication ,所以Type:Basic Auth


2,Headers
content-type:application/json

点击Authorization
输入Username,Password,并且勾选save helper data to request

此时Headers就会多出一行
Authorization:Basic dGVzdDI6dGVzdDg4Kioq


3,Body
选择raw,输入请求参数

eg:https://test.baidu.com/api/Subject/:id
这种参数是直接跟在URL后面,会自动弹出key-Value-edit

https://test.baidu.com/api/query
这种请求参数是要写在body>raw里面的

点击send,调用接口后,会有返回结果
可根据status及返回内容获取需要内容

猜你喜欢

转载自lanyan-lan.iteye.com/blog/2414257
今日推荐