docs/devguide/how-tos/Workflows/creating-workflows.md
You can create and update workflows using the Conductor UI, APIs, or SDKs. These workflows can be versioned, which is useful for a variety of cases.
If your workflow definition contains any new tasks, you must also register the task definitions to Conductor before running the workflow.
With the UI, you can create or update workflow definitions visually.
To create a workflow definition:
To update a workflow definition:
You can create or update workflow definitions using the Conductor CLI. Save your workflow definition to a JSON file and run:
conductor workflow create workflow.json
Refer to Workflow Definition for the reference guide on the full parameters.
You can also create or update workflow definitions using the Update Workflow Definition API (PUT api/metadata/workflow).
Refer to Workflow Definition for the reference guide on the full parameters.
??? note "Example using cURL"
shell curl '{{ server_host }}/api/metadata/workflow' \ -X 'PUT' \ -H 'accept: */*' \ -H 'content-type: application/json' \ --data-raw '[{"name":"sample_workflow","description":"shipping","version":1,"tasks":[{"name":"ship_via","taskReferenceName":"ship_via","type":"SIMPLE","inputParameters":{"service":"${workflow.input.service}"}}],"inputParameters":["service"],"outputParameters":{},"schemaVersion":2, "ownerEmail": "[email protected]"}]'
Conductor offers client SDKs for popular languages which have library methods for making the API call. Refer to the SDK documentation to configure a client in your selected language to invoke workflow executions.
Refer to Workflow Definition for the reference guide on the full parameters.
In this example, the JavaScript Fetch API is used to create the workflow sample_workflow.
fetch("{{ server_host }}/api/metadata/workflow", {
"headers": {
"accept": "*/*",
"content-type": "application/json"
},
"body": "[{\"name\":\"sample_workflow\",\"description\":\"shipping\",\"version\":1,\"tasks\":[{\"name\":\"ship_via\",\"taskReferenceName\":\"ship_via\",\"type\":\"SIMPLE\",\"inputParameters\":{\"service\":\"${workflow.input.service}\"}}],\"inputParameters\":[\"service\"],\"outputParameters\":{},\"schemaVersion\":2,\"ownerEmail\": \"[email protected]\"}]",
"method": "PUT"
});