[英]How to poll the quality gate execution status?
I would like to poll the quality gate execution status of my SonarQube 6.3 instance using a REST api call. 我想使用REST api调用来轮询SonarQube 6.3实例的质量门执行状态。 I went through a few api calls, which did not give me the expected results.
我经历了一些api电话,但没有给我预期的结果。
I tried to use these urls: 我试图使用这些网址:
But I always got this response: 但我总是得到这样的答复:
{"errors":[{"msg":"Unknown url : /api/resources"}]}
How can I poll the quality gate execution status via REST? 如何通过REST轮询质量门执行状态?
http://localhost:9000/web_api lists the web service endpoints available on your server and provides documentation for each one. http:// localhost:9000 / web_api列出了服务器上可用的Web服务端点,并提供了每个端点的文档。 In my copy of 6.3, the documentation for "api/resources" says
在我的6.3副本中,“api / resources”的文档说
Removed since 6.3, please use api/components and api/measures instead
自6.3以来删除,请改用api / components和api / measures
You say you've tried http://localhost:9000/api/components and gotten an error. 你说你已经尝试了http:// localhost:9000 / api / components并得到了一个错误。 That's because there's not actually a web service there.
那是因为那里实际上没有网络服务。 You'll have to add the qualifier for the service you want, such as
/api/components/search
, as described in the docs for that set of services: http://localhost:9000/web_api/api/components 您必须为所需的服务添加限定符,例如
/api/components/search
,如该组服务的文档中所述: http:// localhost:9000 / web_api / api / components
In fact there are 5 parts in a correct SonarQube web api url. 事实上,正确的SonarQube网络应用程序中有5个部分。 They can be seen like that
domain/api/controller/action?parameters
, for example http://localhost:9000/api/components/show?componentKey=blue
. 它们可以看作是
domain/api/controller/action?parameters
,例如http://localhost:9000/api/components/show?componentKey=blue
。
So we have: 所以我们有:
http://localhost:9000
in the example, it is the address where you can call your SonarQube server http://localhost:9000
表示,它是您可以调用SonarQube服务器的地址 /api
in the example, it is the base path of all web service in SonarQube /api
表示,它是SonarQube中所有Web服务的基本路径 /components
in the example, it represents a pool of web service concerning a given theme (issues, profiles, components, etc.) /components
表示,它表示关于给定主题的Web服务池(问题,配置文件,组件等) /show
in the example, it is a unit action that you can perform through the web service, for example: show, search, list, backup, delete, etc. /show
表示,它是您可以通过Web服务执行的单元操作,例如:show,search,list,backup,delete等。 ?componentKey=blue
in the example, they are not always mandatory but often allow you to specify further information to get more precise results ?componentKey=blue
表示,它们并不总是强制性的,但通常允许您指定更多信息以获得更精确的结果 What you have forgotten here is at means to specify an action . 你在这里忘记的是指定一个动作 。
http://localhost:9000/api/project_analyses/search?project=myProjectname&category=QUALITY_GATE
This query returned the status of my quality gate. 此查询返回了我的质量门的状态。 Here I have mentioned the project name as myProjectname
这里我提到项目名称为myProjectname
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.