Trigger a build with payload and get back deploy id

Hi

We have a Netlify-Github-Gatsby build flow that we want to modify with an option to trigger a build with a PAYLOAD, and get back the deploy/build id in order to be able to cancel it afterwards.

We have explored:

  • Webhooks:
    :white_check_mark: Triggers build
    :white_check_mark: Exposes payload (process.env.INCOMING_HOOK_BODY)
    :x: Does not return a deploy id

  • POST /api/v1/sites/site_id/builds
    :white_check_mark: Triggers build
    :white_check_mark: Returns a deploy id
    :x: Does not seem to accept a payload.

  • POST /api/v1/sites/site_id/deploys
    :white_check_mark: Triggers build
    :x: Stuck at “Branch Deploy [NEW]” - I can’t figure out how to target Production: master.

Any help is appreciated.

I don’t think this is currently possible in the flow you’re expecting. The only way to do it would be to trigger a deploy and then get a list of all deploys and filter the deploy you require.

1 Like

Thanks for the response, @hrishikesh.

For future reference, I went with triggering a webhook via an external service, then passing process.env.DEPLOY_ID or process.env.BUILD_ID via the code back to the service (if you want to control the builld in progress)