Must-share information (formatted with Markdown):
- SonarQube Version : 8.5.1
- We would like to automate rules creation and mapping to quality profile via Json foramt.
- SonarQube rules creation works with below parameter but not working Json format
curl -su admin:admin \ -X POST \ -d 'template_key=javascript%3ACommentRegularExpression&custom_key=customRuleTest&name=customRuleTest&markdown_description=My%20custom%20rule&severity=MAJOR' \ 'http://localhost:9000/api/rules/create'
===
Below options are tried.
curl -v -su admin:password' --header "Content-Type: application/json" -X POST -d @sonarqube.json 'https://sonarqube.com/api/rules/create'
Content of sonarqube.json:
{ "custom_key": "key1", "key": "ClangTidy:test", "repo": "ClangTidy", "name": "custom", "severity": "INFO", "templateKey": "ClangTidy:CustomRuleTemplate", "type": "CODE_SMELL" }
Tried by passing option in curl command as well but didn’t work. It is not able to read the values to pass while creation and says not able to find “custom_key”.
Please help us to fix the issue.
Thanks in Advance!!!