Get all Projects names in your SonarQube server

Viewed 11715

There used to be "api/resources/" api to realize this. But unfortunately its not in my v6.4.

I tried "/api/qualitygates/search?gateId=1" after confirming that the Default Qualitygate is "SonarQube way" using this api to confirm it "api/qualitygates/list" but I get.

{"more":false,"results":[]}

Is there any easy way to get all the projects in my SonarQube server by the API?

3 Answers

This will also give list of projects

http://sonar-domain/api/projects/search?qualifiers=TRK&ps=500

Response:

{
  "paging": {
    "pageIndex": 1,
    "pageSize": 500,
    "total": 2
  },
  "components": [
    {
      "organization": "my-org-1",
      "id": "project-uuid-1",
      "key": "project-key-1",
      "name": "Project Name 1",
      "qualifier": "TRK",
      "visibility": "public",
      "lastAnalysisDate": "2017-03-01T11:39:03+0300"
    },
    {
      "organization": "my-org-1",
      "id": "project-uuid-2",
      "key": "project-key-2",
      "name": "Project Name 1",
      "qualifier": "TRK",
      "visibility": "private",
      "lastAnalysisDate": "2017-03-02T15:21:47+0300"
    }
  ]
}
Related