fix: Workflow activation with versionId

- Extract versionId from workflow import response
- Use POST /rest/workflows/{id}/activate with versionId
- Workflow is now automatically activated after import

Tested successfully on container sb-1769174647
This commit is contained in:
2026-01-23 14:27:03 +01:00
parent ff1526cc83
commit f6637080fc

View File

@@ -743,18 +743,19 @@ WORKFLOW_RESP=\$(curl -sS -X POST "\${API_URL}/rest/workflows" \\
-d @/tmp/rag_workflow.json)
WORKFLOW_ID=\$(echo "\$WORKFLOW_RESP" | grep -oP '"id"\s*:\s*"\K[^"]+' | head -1)
VERSION_ID=\$(echo "\$WORKFLOW_RESP" | grep -oP '"versionId"\s*:\s*"\K[^"]+' | head -1)
if [ -z "\$WORKFLOW_ID" ]; then
echo "WORKFLOW_IMPORT_FAILED: \$WORKFLOW_RESP"
exit 1
fi
echo "Workflow imported: \$WORKFLOW_ID"
echo "Workflow imported: \$WORKFLOW_ID (version: \$VERSION_ID)"
# Activate workflow
# Activate workflow using POST /activate endpoint with versionId
echo "Activating workflow..."
ACTIVATE_RESP=\$(curl -sS -X PATCH "\${API_URL}/rest/workflows/\${WORKFLOW_ID}" \\
ACTIVATE_RESP=\$(curl -sS -X POST "\${API_URL}/rest/workflows/\${WORKFLOW_ID}/activate" \\
-H "Content-Type: application/json" \\
-b "\${COOKIE_FILE}" \\
-d '{"active": true}')
-d "{\"versionId\":\"\${VERSION_ID}\"}")
if echo "\$ACTIVATE_RESP" | grep -q '"active":true\|"active": true'; then
echo "Workflow activated successfully"