Search code examples
sonarqubesonarqube-web

How can I access to number of blocker and critical issues for each sonarqube analysis?


I saw in the sonar time machine that it was possible to see for each analysis the number of blocker and critical issues, but I didn't find where these metrics are stocked and how to retrieve them one by one externally with a Java program.


Solution

  • You should use the web service api/timemachine/index. It is documented within the application, for example at https://sonarqube.com/web_api/api/timemachine/index

    The metrics for having numbers of issues are violations (total number, whatever the severity), blocker_violations, critical_violations, major_violations, minor_violations and info_violations.

    Example: https://sonarqube.com/api/timemachine/index?resource=org.fitnesse:fitnesse&metrics=blocker_violations,critical_violations