Activate Rules for Quality profiles using api

Must-share information (formatted with Markdown):

  • SonarQube Version 8.5.1
  • We are trying to automate rules creation and activating rules to specific quality profile using api calls
  • We are able to create rules using /api/rules/create api call but we don’t find option to activate that rule to specific quality profile.

Could you please let us know if there is a way to achieve this ?


Hello @jagadeeswar and welcome to the community :wave:

sounds like api/qualityprofiles/activate_rule or api/qualityprofiles/activate_rules would be the api endpoint that you are looking for?

Thanks @Tobias_Trabelsi.
Yes exactly the same i am looking for. We want to associate a rule to a particular Quality Profile.
We would like to know the exact options / parameters for achieving this, Could you please share some examples ?


Hi @jagadeeswar ,

did you had a look at the embedded api documentation? you can find it if you click at the question mark next to search projects and then on “web API” (if you run on localhost with port 9000 it would be on http://localhost:9000/web_api/) . there you can find more information about the api usage and the parameter that are required etc.

in your case the call could be looking something like this:

curl -u admin:admin -X POST "http://localhost:9000/api/qualityprofiles/activate_rule?key=<YOUR QUALITY PROFILE KEY>&rule=<YOUR RULE KEY>&severity=MAJOR"
1 Like

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