@SE-automations
He realizado cambios en los últimos 2 nodos. Ahora está funcionando
{
"nodes": [
{
"parameters": {},
"id": "7c366a4c-e62d-4d98-9596-259e806aa7a9",
"name": "When clicking \"Execute Workflow\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
-256,
-112
]
},
{
"parameters": {
"fields": {
"values": [
{
"name": "workflowId",
"stringValue": "YOUR_TARGET_WORKFLOW_ID"
},
{
"name": "newDescription",
"stringValue": "This description was updated via API!"
},
{
"name": "apiKey",
"stringValue": "YOUR_N8N_API_KEY"
},
{
"name": "baseUrl",
"stringValue": "https://your-n8n-instance.com"
}
]
},
"options": {}
},
"id": "b26141cc-8a55-4085-b351-4a099ceca651",
"name": "Set Parameters",
"type": "n8n-nodes-base.set",
"typeVersion": 3.2,
"position": [
-32,
-112
]
},
{
"parameters": {
"url": "={{$json.baseUrl}}/api/v1/workflows/{{$json.workflowId}}",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"options": {}
},
"id": "c3dc2010-db72-45a1-8d7e-fa4da8c6b726",
"name": "Get Current Workflow",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
192,
-112
]
},
{
"parameters": {
"jsCode": "const workflow = $input.first().json;\nconst params = $(\"Set Parameters\").first().json;\n\n// n8n's public PUT /api/v1/workflows/{id} endpoint rejects some\n// settings returned by GET, especially settings.binaryMode.\n// Build a clean request body with only accepted workflow-update fields.\nconst cleanSettings = {};\nif (workflow.settings?.executionOrder !== undefined) {\n cleanSettings.executionOrder = workflow.settings.executionOrder;\n}\n\nreturn {\n name: workflow.name,\n description: params.newDescription,\n nodes: workflow.nodes,\n connections: workflow.connections,\n settings: cleanSettings,\n};"
},
"id": "396b85c0-72a8-474d-b629-87ab5ccf026c",
"name": "Clean
& Add Description",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
432,
-112
]
},
{
"parameters": {
"method": "PUT",
"url": "={{$(\"Set Parameters\").first().json.baseUrl}}/api/v1/workflows/{{$(\"Set Parameters\").first().json.workflowId}}",
"authentication": "predefinedCredentialType",
"nodeCredentialType": "n8nApi",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({\n name: $json.name,\n description: $json.description,\n nodes: $json.nodes,\n connections: $json.connections,\n settings: {\n executionOrder: $json.settings?.executionOrder ?? 'v1',\n },\n}) }}",
"options": {}
},
"id": "f4f011eb-0bb9-4ecd-86b5-3a273b839d5a",
"name": "Update Workflow",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.1,
"position": [
640,
-112
],
"credentials": {
"n8nApi": {
"id": "tJzSKMBOStUkRFnW",
"name": "n8n account"
}
}
}
],
"connections": {
"When clicking \"Execute Workflow\"": {
"main": [
[
{
"node": "Set Parameters",
"type": "main",
"index": 0
}
]
]
},
"Set Parameters": {
"main": [
[
{
"node": "Get Current Workflow",
"type": "main",
"index": 0
}
]
]
},
"Get Current Workflow": {
"main": [
[
{
"node": "Clean
& Add Description",
"type": "main",
"index": 0
}
]
]
},
"Clean
& Add Description": {
"main": [
[
{
"node": "Update Workflow",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {},
"meta": {
"instanceId": "1a1f57ec2a2da833e112999d86f7d337d8347efc10e2e2a4dab8d5b310dec682"
}
}