Reputation: 796
I would like to poll the quality gate execution status of my SonarQube 6.3 instance using a REST api call. I went through a few api calls, which did not give me the expected results.
I tried to use these urls:
But I always got this response:
{"errors":[{"msg":"Unknown url : /api/resources"}]}
How can I poll the quality gate execution status via REST?
Upvotes: 1
Views: 2179
Reputation: 796
http://localhost:9000/api/project_analyses/search?project=myProjectname&category=QUALITY_GATE
This query returned the status of my quality gate. Here I have mentioned the project name as myProjectname
Upvotes: 0
Reputation: 776
In fact there are 5 parts in a correct SonarQube web api url. They can be seen like that domain/api/controller/action?parameters
, for example http://localhost:9000/api/components/show?componentKey=blue
.
So we have:
http://localhost:9000
in the example, it is the address where you can call your SonarQube server/api
in the example, it is the base path of all web service in SonarQube/components
in the example, it represents a pool of web service concerning a given theme (issues, profiles, components, etc.)/show
in the example, it is a unit action that you can perform through the web service, for example: show, search, list, backup, delete, etc.?componentKey=blue
in the example, they are not always mandatory but often allow you to specify further information to get more precise resultsWhat you have forgotten here is at means to specify an action.
Upvotes: 1
Reputation: 22824
http://localhost:9000/web_api lists the web service endpoints available on your server and provides documentation for each one. In my copy of 6.3, the documentation for "api/resources" says
Removed since 6.3, please use api/components and api/measures instead
You say you've tried http://localhost:9000/api/components and gotten an error. That's because there's not actually a web service there. You'll have to add the qualifier for the service you want, such as /api/components/search
, as described in the docs for that set of services: http://localhost:9000/web_api/api/components
Upvotes: 3