You can trigger a particular workflow using the following API call. You can either trigger an existing workflow that already contains other triggers, or a new trigger using this method. If you want to trigger a new workflow, create a config file without the triggers
field.
Path
POST
https://<org subdomain>.neetoci.com/api/v1/trigger_ci_job
Replace <org subdomain>
in the URL with the subdomain of your organization.
Headers
X-Api-Key
- Contains a neetoCI API Key.
Body Params
branch_name
- Name of the branch on which the CI Job should be run.project_name
- Name of the project in the neetoCI app.workflow_name
- Name of the workflow file.
Example
{
"branch_name": "add-api-trigger-workflow",
"project_name": "wheel",
"workflow_name": "default"
}
Creating a webhook
You can create a webhook that sends updated information on the CI Job that was triggered, every time the status of the CI Job changes.
In order to create a webhook along with the trigger, simply pass the endpoint at which the webhook should send requests, in the webhook_url
parameter.
Example
{
"branch_name": "add-api-trigger-workflow",
"project_name": "wheel",
"workflow_name": "default",
"webhook_url": "https://example.com/path/to/endpoint"
}
The webhook requests will also contain the API Key header from the trigger request - X-Api-Key
. You can use it to authenticate the webhook requests on your endpoint.
Sample Payload from Trigger endpoint and Webhook
{
"ci_job": {
"id": "d81e8f73-0881-450b-af0a-68414d2d90ed",
"created_at": "2023-10-30T12:00:32.405Z",
"status": "pending",
"parallelism": 1,
"url": "https://subdomain.neetoci.com/projects/wheel/jobs/d81e8f73-0881-450b-af0a-68414d2d90ed",
"workflow": {
"is_cypress": false,
"name": "default",
"plan": {
"id": "1528a387-b4c0-4741-a2a2-87fce91f0bdc",
"capacity": 5,
"cpu": 0.5,
"memory": 1.0,
"name": "Basic",
"price": 0.0,
"slug": "basic",
"created_at": "2023-07-14T02:56:48.079Z",
"updated_at": "2023-07-14T02:56:48.079Z",
"ephemeral_storage": 10.0
}
}
}
}