The way how to bulk-activate rules in Web API

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • what are you trying to achieve
  • what have you tried so far to achieve this


  1. Sonarqube 7.9.1
  2. Scanner 4.6.2

*I tried “api/qualityprofiles/activate_rules?targetKey=‘MyQualityProfileKey’”.
It works if I want to activate all of the rules.
But I just wanted to activate specific rules(like csharpsquid:S2757, csharpsquid:S1698, …) on my custom quality profile.
So I added rule_key parameter and set the value to ‘csharpsquid:S2757’. then It activates only one rule. If I set the value to ‘csharpsquid:S2757,csharpsquid:S1698’ or ‘csharpsquid:S2757;csharpsquid:S1698’, It doesn’t work.
How can I set bulk-activate in Web API?


Your best bet here is to bulk-activate some rules via the UI and use your browser’s developer tools to eavesdrop on the web service that’s called.


I really appreciate your answer.
Eventually, You mean that there is no way to bulk-activate/deactivate rules on Web API, right?

As you can see those pictures, I tried by using Web API instead of UI.
I can’t activate more than one ruleset at a time.


You can bulk activate/deactivate rules from the UI. All the actions in the UI are backed / supported / provided by the API. If you can do it in the UI you can do it in the API (altho to be fair, some actions are supported by “internal” API).

So I am not saying that you can’t bulk activate via the API. I’m saying use the UI to figure out how to do it.


What I want to know is that I just wanted to bulk-activate/deactivate on Web API. not from the UI.