Builds: Stop builds by API

Hi I’m trying to achieve the following flow:

1 Site is connected to Github repo but never auto builds on a code update
2 When I need I trigger a build by API request it builds a preview with the actual Github repo code.
3 If I happy with a preview I deploy it to production with another API request

While building and deploying via API works fine I don’t want to spent build minutes on code updates. So I’d like to keep auto building disabled unless I’m going to build manually from API.

The problem is that if I disable site builds from UI I also can’t trigger build from API. It returns me a "message":"Builds for this site are currently stopped". That’s why I’m going to keep it disabled unless I enable by PATCH request:

PATCH {{base}}sites/{{siteId}}
Authorization: Bearer {{token}}

{
  "build_settings": {
    "stop_builds": false,
  }
}

But this request doesn’t change the setting. I’ve also tried to pass the full body but with the same result. However, it does not return any errors.

Is this a bug or am I missing something?

I have a demo project to reproduce it peaceful-jackson-fb673c but I tried it with different projects - it always behaves the same way

Solved

In my case it was missed content-type: application/json :laughing:
so it should be

PATCH {{base}}sites/{{siteId}}
content-type: application/json
Authorization: Bearer {{token}}

{
  "build_settings": {
    "stop_builds": false,
  }
}