接口工具 YApi , Postman
YApi
YApi是去哪网大前端技术中心的一个开源可视化接口管理平台。
YApi项目可以搭建在任何本地或云服务器上,完成后台项目开发时的接口编写。为开发、测试等人员提供可视化的接口预览。
去哪同时在网上提供了YApi的测试网站:http://yapi.demo.qunar.com/,我们可以通过测试网站了解YApi是如何进行接口的编写的
- 访问测试网站
- 创建接口项目
- 创建接口
- 编写接口
接口测试工具:Postman
Postman是一款接口调试工具,是一款免费的可视化软件,同时支持各种操作系统平台,是测试接口的首选工具。
Postman可以直接从官网:https://www.getpostman.com/downloads/下载获得,然后进行傻瓜式安装。
- get请求,携带参数采用Params
- post等请求,提交数据包可以采用三种方式:form-date、urlencoding、json
- 所有请求都可以携带请求头
图解
- 工作面板
- 简易的get请求
- 简易的post请求
- 案例:请求百度地图接口