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?
SonarQube lets you get exhaustive data using its Web API. Taking your example of project's measures:
Use api/measures
Web API (see parameters in documentation). Example for project postgresql:
Get the component ID:
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
Use api/resources
Web API:
http://sonarqube_url/api/resources?resource=your_resource&metrics=metric_key
Use api/metrics/search
(documented here), see also Metric Definitions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With