I am using SonarQube 5.1.2 on Windows 7 Professional. I am using Web Service API over cURL 7.32.0 (x86_64-pc-win32). I want to upload sonar.exclusions and few more such properties for a specific project using POST.
I use curl -u admin:admin -X POST http://localhost:9512/api/prop
erties/?id=sonar.exclusions -v -T "D:\sonar-exclusions.xml"
and I am able to POST it as global sonar.exclusions.
Where as if I use resource
to post it to a specific project with the command - curl -u admin:admin -X POST http://localhost:9512/api/prop
erties/?id=sonar.exclusions&resource=org.myProject:myProject -v -T "D:\sonar-exclusions.xml"
I get the error {"err_code":200,"err_msg":"property created"}'resource' is not recognized as an
internal or external command, operable program or batch file
What's going wrong with the resource
parameter here?
The problem is with the &
in the URL, it's interperted by your command line prompt as: Let me run this command:
curl -u admin:admin -X POST http://localhost:9512/api/properties/?id=sonar.exclusions
and then run this command:
resource=org.myProject:myProject -v -T "D:\sonar-exclusions.xml"
The first one returns {"err_code":200,"err_msg":"property created"}
while the second one is bound to fail with:
'resource' is not recognized as an internal or external command, operable program or batch file
You should either escape the &
or simply put the URL between "quotes".