声纳休息API权限不足 [英] Sonar rest API insufficient privileges

查看:161
本文介绍了声纳休息API权限不足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我无法访问大多数Sonar API

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

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

或参见api/sources/scm. api/server/system和其他一些常规的东西都可以,但是在我实际看到代码的地方却没有.
我总是得到

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"}]}

我设置了项目权限,以允许任何人查看源代码&浏览该项目,我尝试使用Postman,Java HttpRequest,命令行...
curl -u admin:admin localhost:9000/api/tests/show?key=htmlparser:/src/test/java/HtmlParserTest.java
我检查了SonarQube 5.1和4.5.1.我发现了具有相同问题的帖子,但尚未找到解决方法.有人有解决方案的想法吗?
谢谢您的帮助

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

推荐答案

解决方案
这是语法错误(即使消息说权限不足).正确的呼叫应为:

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

如果不确定"src/..."之前的内容,请不要担心.您可以通过调用api/projects/index并查看名为"k"的属性来获取它.

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".

这篇关于声纳休息API权限不足的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆