I validated this document with the view.xsd document in order to be sure this document is correctly formatted. Then I used curl to send this file to the sonar server : curl -s -X POST -u mysecrettoken: http://sonar.instance.url/api/views/define?def="D:\tmp\simple-def.xml"
But it tells me {"errors":[{"msg":"Could not load views definition file. Please validate views.def against schema at <sonar.host.url>/static/governance/views.xsd"}]}
There is already some portfolios available on this server, maybe I need to delete them all first before uploading another file ?
First, I believe that when you succeed in uploading your definition, it will overwrite whatever is there already. So… be aware of that.
Also, you can easily download (/api/views/definition) the definition for what’s already there to take a look at it. When I download from our dogfooding instance, I get XML that starts merely with <views>, versus your more formal & correct version. That’s probably not the issue tho.
When I check the API docs it mentions the integrity checks that happen on the back end
(e.g loops in local references, duplicate project associations)
I’m wondering if you’re hitting a problem with that & just getting a bad error message back.