which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
what are you trying to achieve
what have you tried so far to achieve this
Using version SonarQube 7.9.5
Wanted to get all project data like code smells,bug,vulnerabilities ,last aalysis date,bug,coverage,duplications,Last analysis date specified in the dashboard for each project.
Did not find an API which returns exactly this .
Could you please help ?
yeah you can do that via the api but you will need to do multiple calls.
for project data, like code smells and vulnerabilities and stuff you need to call api/measures/component while the last analysis date can be obtained with api/components/show. you can view the documentation for each of these api endpoints directly in SQ when clicking on web_api in the footer of SQ.
for api/measures/component you will need to create a list with fields that you want to get, so something like this:
The SQ frontend fetches all data via API calls to the backend, so when you are not sure how something works the network tab in your browser might be useful too
@Tobias_Trabelsi Thankyou so much .As I am very new to this.What is component id ?
How can we get that ? .If I want any other fields like codesmell,duplications can we add to this ? Will it retrieve for every project present in the dashboard by using the api specified ?
The component ID is the one that is specified when creating a new project in SQ. you can view it in the URL of the dashboard of each project as well, for example with this project in our sonarqube instance: SonarQube the ID would be org.sonarsource.java%3Ajava. you can also view it when you click on project information there.
in my snippet for api/measures/component the fields for codesmell and duplications are already added.