Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make a workflow instance whith not runing? #5087

Closed
coolshun opened this issue Mar 19, 2024 · 1 comment
Closed

How to make a workflow instance whith not runing? #5087

coolshun opened this issue Mar 19, 2024 · 1 comment

Comments

@coolshun
Copy link

The api "/workflow-definitions/{definitionId}/execute",will make a workflow instance with "runing"status. How to make it ,but not runing auto?and then ,how to start the instance manuallly?

Copy link

glime-ai bot commented Mar 19, 2024

To create a workflow instance without immediately executing it, you can use the /workflow-definitions/{workflow_definition_id}/dispatch endpoint. This will enqueue the workflow for execution and return the workflow instance ID, but it will not start running the workflow automatically.

Here is an example of how you would call this endpoint:

curl --location --request POST 'https://localhost:5001/elsa/api/workflow-definitions/{workflow_definition_id}/dispatch' \
--header 'Content-Type: application/json' \
--header 'Authorization: ApiKey {api_key}'

Make sure to replace {workflow_definition_id} with the actual ID of your workflow definition and {api_key} with your actual API key.

Once you have the workflow instance ID, you can start the workflow instance manually using the /workflow-instances/{workflow_instance_id}/execute endpoint. Here is an example of how to start a workflow instance manually:

curl --location --request POST 'https://localhost:5001/elsa/api/workflow-instances/{workflow_instance_id}/execute' \
--header 'Content-Type: application/json' \
--header 'Authorization: ApiKey {api_key}'

Again, replace {workflow_instance_id} with the ID of the workflow instance you want to start and {api_key} with your actual API key.

By using the /dispatch endpoint to create the instance and the /execute endpoint to start it manually, you can control when the workflow instance begins execution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant