[API] project_status and branches

Hello all,

Hope you’re fine. I’ve a little question relating to the SonarQube(version 6.7) API and more especially the method project_status.

I use the API and this method to get the status of the quality gate of the project. It was working perfectly until the activation of the branch plugin, I’ve the wrong information. According to the documentation of the method, there is no ‘branch’ parameters.

My question is the following, how can I get the status of quality gate for a specific branch in a project?

Regards,

Geoffrey

Hi Geoffrey,

Does this help ?

Hi Nicolas,

Thank you for your answer.
These methods don’t give me the status of the quality gate unfortunately, in my case it doesn’t help.

Regards,

Geoffrey

Browser inspector is a good way to see how the UI behaves under the hood (pro-tip: UI consumes WebAPI). Apparently api/project_branches/list can help !

Hi @galexandre,

the api documentation seems to not be updated but you can with the following URI : /api/measures/component?component={componentKey}&metricKeys=alert_status&branch={branchName}

:slight_smile:

Hi @honorec,

the api documentation has the branch parameter, but as internal parameter it’s only visible when ‘Show Internal API’ checkbox is activated.

Gilbert

Hi @honorec and @Rebse

Thank you for your answer. I found a way around for this issue.
I will close it.

Regards,

Geoffrey

Hi @galexandre,

maybe this is helpful too

and also GitHub - SonarSource/sonar-custom-plugin-example: Shows how to write a SonarQube plugin
The example has a custom page that shows projects and Quality gate status, but only for the main branch (default = master).

Gilbert