在 Ubuntu 上,Postman 本身是支持命令行使用的,不过要分两种情况来看:
.deb 或 Snap 安装的 Postman 是 图形界面程序Newman 是 Postman 官方的命令行运行器。
sudo apt install nodejs npm
sudo npm install -g newman
xxx.jsonnewman run xxx.json
newman run xxx.json -e env.json
newman run collection.json \
-e environment.json \
--reporters cli,html \
--reporter-html-export report.html
✅ 适合:
其实不一定非要用 Postman:
curl https://api.example.com/users
或
http GET api.example.com/users
(HTTPie,更易读)
| 方式 | 是否命令行 | 说明 |
|---|---|---|
| Postman GUI | ❌ | 图形界面 |
| Newman | ✅ | Postman 官方 CLI |
| curl / httpie | ✅ | 轻量替代 |
如果你是 想在服务器上跑 Postman 接口测试,我可以直接给你一套 Newman + CI 的示例。