- SonarQube Version: 9.9.1.69595
- Privileges: Administer System
I am working on a project to query all the projects and their corresponding Quality Profiles from the SonarQube API. The users using this data have complained that there are projects without quality gates in the data. I’ve taken a few of their project keys and put them into SonarQube’s UI with returns an empty response. As if they have been deleted, which very well may be the case. The problem I run into is when I search the API for the same project key, it returns a value. So in my script to pull the projects, I get projects that don’t exist in the UI. And when take those projects and do the following API calls. I can find a project but all other calls lead me to believe the project doesn’t exist.
Calling:
api/projects/search?projects=<project_key>
Returns:
{"paging":{"pageIndex":1,"pageSize":100,"total":1},"components":[{"key":"<project_key>","name":"<project_name>","qualifier":"TRK","visibility":"private"}]}
Calling:
api/qualitygates/get_by_project?project=<project_key>
Returns:
{"errors":[{"msg":"Insufficient privileges"}]}
Calling:
api/qualitygates/project_status?project=<project_key>
Returns
{"projectStatus":{"status":"NONE","conditions":[],"periods":[],"caycStatus":"compliant"}}
How can I make the API calls be consistent with what I’m seeing in the UI?