# 操作模式指南
按节点类型和操作组织的常见节点配置模式。
---
## 概述
**目的**:常见节点配置的快速参考
**覆盖范围**:525 个可用节点中 20 个最常用的节点
**模式格式**:
- 最小有效配置
- 常见选项
- 实际案例
- 注意事项与技巧
---
## HTTP 与 API 节点
### HTTP 请求 (nodes-base.httpRequest)
用于 HTTP 操作的最通用节点
#### GET 请求
**最小配置**:
javascript
{
"method": "GET",
"url": "https://api.example.com/users",
"authentication": "none"
}
**带查询参数**:
javascript
{
"method": "GET",
"url": "https://api.example.com/users",
"authentication": "none",
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "limit",
"value": "100"
},
{
"name": "offset",
"value": "={{$json.offset}}"
}
]
}
}
**带身份验证**:
javascript
{
"method": "GET",
"url": "https://api.example.com/users",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "httpHeaderAuth"
}
#### POST (JSON 格式)
**最小配置**:
javascript
{
"method": "POST",
"url": "https://api.example.com/users",
"authentication": "none",
"sendBody": true,
"body": {
"contentType": "json",
"content": {
"name": "John Doe",
"email": "
[email protected]"
}
}
}
**带表达式**:
javascript
{
"method": "POST",
"url": "https://api.example.com/users",
"authentication": "none",
"sendBody": true,
"body": {
"contentType": "json",
"content": {
"name": "={{$json.name}}",
"email": "={{$json.email}}",
"metadata": {
"source": "n8n",
"timestamp": "={{$now.toISO()}}"
}
}
}
}
**注意**:对于 POST/PUT/PATCH,请记住设置 `sendBody: true`!
#### PUT/PATCH 请求
**模式**:与 POST 相同,仅方法不同
javascript
{
"method": "PUT", // 或 "PATCH"
"url": "https://api.example.com/users/123",
"authentication": "none",
"sendBody": true,
"body": {
"contentType": "json",
"content": {
"name": "Updated Name"
}
}
}
#### DELETE 请求
**最小配置** (无 body):
javascript
{
"method": "DELETE",
"url": "https://api.example.com/users/123",
"authentication": "none"
}
**带 body** (部分 API 允许):
javascript
{
"method": "DELETE",
"url": "https://api.example.com/users",
"authentication":