CentOS下Postman生成接口文档的步骤
CentOS系统可通过以下方式安装Postman(以最新稳定版为例):
chmod +x Postman-linux-x64-*.AppImage && ./Postman-linux-x64-*.AppImage)。npm install -g newman。https://api.example.com/users);Content-Type: application/json);{"username": "admin", "password": "123456"});username为用户账号,必填)、预期响应(如返回用户ID和token)。{"code": 200, "data": {"id": 1, "username": "admin"}},失败返回{"code": 400, "message": "用户名不能为空"})。https://documenter.getpostman.com/view/1234567/User-API/7XyZ123),团队成员可通过该链接访问最新文档。~/Documents/API_Docs),即可将文档下载到本地。docgen工具(wget https://raw.githubusercontent.com/thedevsaddam/docgen/v3/install.sh -o install.sh && sudo chmod +x install.sh && sudo ./install.sh && rm install.sh),通过命令docgen build -i ~/Downloads/User_API.postman_collection.json -o ~/Documents/API_Docs/html -m生成Markdown文档(-m表示生成Markdown格式)。newman,运行newman run ~/Collections/User_API.postman_collection.json -e ~/Environments/dev.postman_environment.json -o ~/Documents/API_Docs/html,生成包含测试结果的HTML文档。