在 Ubuntu 上使用 Postman 发送请求,一般步骤如下:
一、安装 Postman
方法 1:通过 Snap 安装(推荐)
sudo snap install postman
安装完成后,可在应用菜单中搜索 Postman 启动。
方法 2:下载官方压缩包
- 打开官网:https://www.postman.com/downloads/
- 选择 Linux 版本
- 解压:
tar -xvf Postman-linux-x64-*.tar.gz
- 运行:
./Postman/Postman
二、启动 Postman
postman
(Snap 安装可用)
三、发送一个请求(以 GET 为例)
- 打开 Postman
- 点击左上角 “+ New” → “HTTP Request”
- 请求类型选择 GET
- 输入 URL,例如:
https://jsonplaceholder.typicode.com/posts/1
- 点击 Send
- 下方会显示:
- Status(状态码)
- Headers
- Body(返回数据)
四、发送 POST 请求(示例)
- 请求类型选择 POST
- URL 输入:
https://jsonplaceholder.typicode.com/posts
- 切换到 Body
- 选择:
- 输入内容:
{
"title": "test",
"body": "hello",
"userId": 1
}
- 点击 Send
五、设置请求头(Headers)
Key: Content-Type
Value: application/json
六、常见用途示例
- 调用 REST API
- 测试后端接口
- 模拟登录(Cookie / Token)
- 文件上传(form-data)
如果你愿意,可以告诉我:
- 你用的是 Ubuntu 哪个版本
- 想发的是 GET / POST / 文件上传
- 是否涉及 Token / Cookie / HTTPS
我可以给你更具体的示例。