So the only way I have found to do this is as follows (please tell me that I am wrong and there is a better way), using Api v2, since I cannot find a way through v1:
[GET] https://api.sonarcloud.io/projects/projects?keys=project_key
Returns LegacyId
[GET] https://api.sonarcloud.io/quality-gates/settings?resourceId=LegacyId&resourceType=PROJECT
Returns an Id (not sure what it is but used in next call)
[PATCH] https://api.sonarcloud.io/quality-gates/settings/id_from_above
Body: {ignoreSmallChanges: false}
The last 2 is taken from the UI (inspector), not documented, so can I rely on these?
This setting cannot be set using the API v1 POST ``https://sonarcloud.io/api/settings/set. sonar.qualitygate.ignoreSmallChanges is a legacy setting in SonarQube Cloud (in fact, it’s not documented, most likely you inferred it from its equivalent in SonarQube Server).
As you found, the way the UI does it is by first finding the project key, then finding the project settings resource ID (this is the ID that you were confused about) and then using it to PATCH the quality gates API with the ignoreSmallChanges setting.
The last 2 is taken from the UI (inspector), not documented, so can I rely on these?
Yes, these API v2 endpoints are “internal”, which means they’re not documented and we don’t guarantee stability. The behavior might change without any deprecation notice. That being said, they’re the only way to automate this particular setting, so from this I would deduce:
This setting is not meant to be automated/controlled via API.
If you really wish to do this, then go ahead, but you have to understand the limitations: breaking changes might happen without notice.