在 Ubuntu 上使用 Postman 测试接口,一般步骤如下:
sudo snap install postman
安装完成后,在应用菜单搜索 Postman 即可打开。
.tar.gz)tar -xzf Postman-linux-x64-*.tar.gz
./Postman/Postman
http://localhost:8080/api/user
常见方法:
GET:查询数据POST:新增数据PUT:更新数据DELETE:删除数据key: id
value: 1
raw → JSON{
"username": "test",
"password": "123456"
}
例如:
Content-Type: application/json
Authorization: Bearer token值
假设 Ubuntu 本地有接口:
GET http://127.0.0.1:3000/api/hello
Postman 中:
http://127.0.0.1:3000/api/hello返回:
{
"message": "Hello from Ubuntu"
}
http://host.docker.internal
如果你有 具体接口示例(如 Spring Boot / Flask / Node.js),我可以帮你写 Postman 测试配置。