Trigger pipeline from HTTP POST


The need is to trigger a pipeline with an HTTP endpoint, passing parameters.

Is this possible at all?


you could use the fly exe or check the go client library


Needs to be via a regular HTTP endpoint… thanks for the answer, though.


If you do a fly trigger-job with --verbose it will print out the API calls it makes.

Provided you can get the auth token you should be able to to a POST to /api/v1/teams/:team/pipelines/:pipeline/jobs/:job/builds with a json object like {"id":3,"team_name":"main","name":"2","status":"pending","job_name":"hello","api_url":"/api/v1/builds/3","pipeline_name":"hello"}.

I haven’t tested this but I’m fairly confident it would work.

1 Like

This is a great step in the right direction, thank you! Still not sure how to determine which build number to automatically input in the api_url field, though…


I just tested this and you don’t actually need to pass anything to the POST. You can just do:

curl -X POST -H "Authorization: Bearer <token>" https://<domain>/api/v1/teams/:team/pipelines/:pipeline/jobs/:job/builds

and it starts a build.


@crsimmons This is the closest yet to having a working solution, thanks!

Still, I’ve tried it locally and I get a not authorized response.

This si the command I am running, with variables obviously replaced with my context:

curl -X POST -H “Authorization: Bearer $(js-yaml ~/.flyrc | jq -r .targets.ies.token.value)” https:///api/v1/teams/:team/pipelines/:pipeline/jobs/:job/builds

Another problem is that this task is meant to run this in a docker container which most likely won’t have that ~/.flyrc file available. It also wouldn’t be expected to work with an hardcoded token for very long if successful as they probably expire pretty fast.


Have you looked at Webhook on the resource.

For example: polling your source control is very expensive on the source control and on concourse side. Instead, let source control poke / webhook to the git resource when it is time to run.