Code Coverage Report via WebAPI

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    Sonarqube 8.9.1

  • what are you trying to achieve

We have a Project which runs and provides the code Coverage Details on the UI like
Bugs, Vulnerabilities, Code Smells and you need to click on each link to go in the details.

What we are trying to achieve:
What we need is to pull that detailed report using WebAPI if that’s an option in HTML/PDF format.

There maybe developers who may not have access to Sonarqube directly, hence we want to send a report directly over email so it can be actioned immediately.

  • what have you tried so far to achieve this
    Unable to find any API in the WebAPI documentation

Hi @vk4linux and welcome to the community :wave:

what edition are you using? There is the option to generate PDF Reports directly from SonarQube in the Enterprise Edition and above.
If you are using Community- or Developer Edition you will need to generate these reports for yourself. You can retrieve some high level information via api/measures/component. if you are looking for some more granular information you can take a look at api/issues/search and extract them from there.
In general you can observer the API calls in your browser that SQ does (inspect element → network tab in chrome). everything you can do in the UI is fetched via a API call.

Could you maybe clarify why some developers do not have access to SonarQube? Is this a government restriction in your company or is there any other reason to restrict access your instance for people that should work with it?

hope that helps :slight_smile: