Setting project settings via REST calls

  • Sonar version used 9.9
  • Im trying to set sonar.issue.ignore.multicriteria setting for a lot of projects(but not all on the server) and with 60 entries. I want to set this using the API call POST api/settings/set.
  • I have tried to run the request with the parameter key - sonar.issue.ignore.multicriteria and fieldValues -json array, where each entry is pair of ruleKey and resourseKey like this:
    { “resourceKey”: “/com//gui/**”, “ruleKey”: “java:S1948” }
    but I receive an exception that tgis is not the right format for fieldValues. I have also tried to run the request for a singe project many times, each with different combination like above, but the calls seems to overwrite the value, not to add new entries.

I think this guide should help you.

Hi,

Thanks for the fast reply. Im already aware of how to find the right API endpoint but, after I have tried many time to set many rules for the above mentioned sonar setting but all attempts resulted in adding one single value and overwriting it each time I try to add one new.
For this reason I decided to ask the community here because nothing was mentioned especially this kind of project setting

The value does get overwritten entirely each time – so you may need to pull any existing values and then add on the new values to your request.

I mentioned the guide because it should show you exactly how it expects the requests to be formatted.

Thanks, I used to Java SDK and I manage to set the the fields

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.