Search code examples
sonarqubedashboard

Filter project search via tags on SonarQube API


On our site we use SonarQube 6.4 to analyze over 150 projects by different teams. While some projects are actually just branches (only differ in version) most of our team projects have a different name. To filter the relevant ones for our team we added tags to the projects, which works fine in the project view (/projects?tags=mytag). However neither the project view list, nor the visualization is for us any useful as a full-screen dashboard (e.g. no checkerboard).

As SonarQube discontinued the dashboard we tried to setup our own by using the provided API, but unfortunately a call to /api/components/search?qualifiers=TRK will just return too many entries and the parameter q for the component name is too restrictive. Unless I missed it, looking at the API description /api/webservices/list it seems it is possible to query for tags on e.g. issues but not on components (neither on SonarQube 6.7 as far as I could tell).

Is there any other convenient way to filter projects by a development team or are there known plans to add the tags filter as well on the component/project search?

Any suggestion is appreciated!

PS: I did try to search here e.g. via '[sonarqube] api tag' but the posts I found where more related to maintain tags but not how to filter on them via the API.


Solution

  • There is not a specific parameter for this. Instead, you'll use the filter parameter, like so: &filter=tags%20%3D%20your-tag-name

    BTW I figured this out by running a tag-specific search on the projects page and using my browser's developer tools to see the requested URL. In general, if the UI gives you a way to pull or narrow a data set then it's supported by the web services ('cause that's where the UI gets its data).