Use any API client, such as an external IDE, to trigger a CloudBees platform workflow run using a curl
command. Users with the appropriate permissions can start a workflow without accessing the UI, as long as the workflow contains a workflow_dispatch
trigger.
Prerequisites
You must first perform the following tasks in order to trigger a workflow remotely:
-
Create a workflow with a manual trigger in the platform.
-
Generate a personal access token in the platform.
Form the curl
command
Configure a curl
command to invoke the manually-triggered workflow.
To form the curl
command:
-
Select an organization, and then select the component with the manually-triggered workflow that you want to run remotely.
-
Locate the component ID and copy it for use in the
curl
command. -
In your component, select a workflow containing a
workflow_dispatch
trigger from Workflows, and then copy the following for use in thecurl
command:-
The workflow branch name.
-
The workflow filename, for example,
my-workflow.yaml
.To be triggered using an API, a workflow must contain a workflow_dispatch
trigger.
-
-
(Optional) Add input parameters to the trigger as key/value pairs, to customize workflow runtime behavior.
-
Using the copied information, configure the
curl
command in the format below:1 Replace <COMPONENT_ID>
with the CloudBees platform component ID to form the endpoint URL.2 Replace <PERSONAL_ACCESS_TOKEN>
with your personal access token.3 Replace <REPOSITORY_BRANCH>
with the repository branch name.4 Replace <WORKFLOW_FILENAME.YAML>
with the workflow filename. For example,my-filename.yaml
.5 Include any applicable parameter names and valid values in the trigger inputs
.
The curl
command is configured to run your workflow remotely.