docs(06): create phase plan for n8n API access
Phase 6: n8n API Access - 1 plan in 1 wave - Covers API-01 through API-04 requirements - Human checkpoint for API key creation + automated verification - Fixed: Use PUT (not PATCH) per current n8n docs Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -103,7 +103,7 @@ const updated = await n8nClient.patch(`/api/v1/workflows/${workflowId}`, {
|
||||
**When to use:** Making incremental changes to existing workflows
|
||||
**Example:**
|
||||
```javascript
|
||||
// Source: Community workflow manager patterns
|
||||
// Source: n8n official docs - public API uses PUT (full replace)
|
||||
async function updateWorkflowNode(workflowId, nodeName, newParams) {
|
||||
// 1. Fetch current workflow
|
||||
const { data: workflow } = await n8nClient.get(`/api/v1/workflows/${workflowId}`);
|
||||
@@ -114,8 +114,9 @@ async function updateWorkflowNode(workflowId, nodeName, newParams) {
|
||||
node.parameters = { ...node.parameters, ...newParams };
|
||||
}
|
||||
|
||||
// 3. Push updated workflow
|
||||
const { data: updated } = await n8nClient.patch(`/api/v1/workflows/${workflowId}`, {
|
||||
// 3. Push updated workflow (PUT requires full workflow body)
|
||||
const { data: updated } = await n8nClient.put(`/api/v1/workflows/${workflowId}`, {
|
||||
name: workflow.name,
|
||||
nodes: workflow.nodes,
|
||||
connections: workflow.connections,
|
||||
settings: workflow.settings
|
||||
@@ -275,16 +276,19 @@ curl -X GET 'http://localhost:5678/api/v1/workflows/1' \
|
||||
-H 'X-N8N-API-KEY: n8n_api_...'
|
||||
```
|
||||
|
||||
### Update Workflow (Partial)
|
||||
### Update Workflow (Full Replace)
|
||||
```bash
|
||||
# Source: Community workflow manager patterns
|
||||
curl -X PATCH 'http://localhost:5678/api/v1/workflows/1' \
|
||||
# Source: n8n official docs - public API uses PUT for workflow updates
|
||||
# Note: Must include name, nodes, connections, settings (full workflow body)
|
||||
curl -X PUT 'http://localhost:5678/api/v1/workflows/1' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'X-N8N-API-KEY: n8n_api_...' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"name": "Workflow Name",
|
||||
"nodes": [...updated nodes array...],
|
||||
"connections": {...updated connections...}
|
||||
"connections": {...updated connections...},
|
||||
"settings": {}
|
||||
}'
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user