How to get quality profiles associated with sonar project or how to get projects associated with quality profile with quali

Must-share information (formatted with Markdown):

  • which versions are you using: SonarQube Community Edition Version 7.2.1 (build 14109)
  • what are you trying to achieve: I need to get a list of sonar projects which are associated with the specific quality profile using web-api. Or a list of quality profiles which associated with the specific sonar project using web-api.
  • what have you tried so far to achieve this: I tried to use /api/qualityprofiles/projects but failed. For example: https:///api/qualityprofiles/projects?key=AWwsrq3aku37rJwYfxkn, where AWwsrq3aku37rJwYfxkn - qualityprofile key which was returned /api/qualityprofiles/search. Sonar returns: {“results”:,“paging”:{“pageIndex”:1,“pageSize”:100,“total”:0},“more”:false}. But there are several Sonar projects which use such profile in Sonar UI.

Could you please help?

Hi,

i can confirm it doesn’t work as expected also with SQ 7.9.1 Enterprise.
Used the developer tools of my browser to see if Sonarqube server uses the same api call when
choosing the link for a non default quality profile at https://somesonarhost/profiles

Afterwards i used exactly the same api call

https://somesonarhost/api/qualityprofiles/projects?key=........&page=1

but the response is

{“results”:,“paging”:{“pageIndex”:1,“pageSize”:100,“total”:0},“more”:false}

Gilbert