[英]SonarQube - Is there an API to grab a part of analysis for all projects you have?
I want to be able to extract, for example, just the Technical Debt numbers out of my sonar instance for all the projects I have, and display them on a page. 例如,我希望能够从我的声纳实例中提取所有项目的技术债务编号,并将其显示在页面上。
Does Sonar provide an api that I can utilize and achieve this? Sonar是否提供了我可以利用并实现这一目标的api?
SonarQube lets you get exhaustive data using its Web API. SonarQube可让您使用其Web API获取详尽的数据。 Taking your example of project's measures: 以你的项目措施为例:
Use api/measures
Web API (see parameters in documentation ). 使用api/measures
Web API(请参阅文档中的参数)。 Example for project postgresql : 项目postgresql的示例:
Get the component ID: 获取组件ID:
https://nemo.sonarqube.org/api/components/show?key=postgresql https://nemo.sonarqube.org/api/components/show?key=postgresql
Get the desired metrics: 获得所需的指标:
https://nemo.sonarqube.org/api/measures/component?componentId=6d75286c-42bb-4377-a0a1-bfe88169cffb&metricKeys=sqale_debt_ratio&additionalFields=metrics,periods https://nemo.sonarqube.org/api/measures/component?componentId=6d75286c-42bb-4377-a0a1-bfe88169cffb&metricKeys=sqale_debt_ratio&additionalFields=metrics,periods
Use api/resources
Web API: 使用api/resources
Web API:
http://sonarqube_url/api/resources?resource=your_resource&metrics=metric_key HTTP:// sonarqube_url / API /资源资源= your_resource&指标= metric_key
Use api/metrics/search
(documented here ), see also Metric Definitions . 使用api/metrics/search
( 此处记录 ),另请参阅度量标准定义 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.