Sonar rest API insufficient privileges

自作多情 提交于 2019-12-13 01:48:56

问题


I can't access most of the Sonar API, for example

localhost:9000/api/tests/show?key=htmlparser:/src/test/java/HtmlParserTest.java

or see api/sources/scm. api/server/system and some other general stuff works but nothing where I actually see the code.
I always get a

{"errors":[{"msg":"Insufficient privileges"}]}

I set the project permissions to let anyone see source code & browse the porject, I tried it with Postman, a Java HttpRequest, the command line ...
curl -u admin:admin localhost:9000/api/tests/show?key=htmlparser:/src/test/java/HtmlParserTest.java
I checked with SonarQube 5.1 and 4.5.1. I've found a posts with the same issue but have yet to find a fix. Does anyone have a solution idea?
Thanks for your help


回答1:


SOLUTION
It was a syntax error (even though the message said Insufficient privileges). The correct call would be:

localhost:9000/api/tests/show?key=htmlparser:htmlparser:src/test/java/HtmlParserTest.java

If you are not sure what goes before the "src/..." don't worry. You can get it by calling api/projects/index and looking at the attribute named "k".



来源:https://stackoverflow.com/questions/33215598/sonar-rest-api-insufficient-privileges

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!