API GET api/qualitygates/project_status

Template for a good new topic, formatted with Markdown:

  • ALM used: Bitbucket
  • CI system used AWS CodePipeline
  • Scanner command used when applicable: sonar-scanner -Dsonar.organization=$Organization -Dsonar.projectKey=$Project -Dsonar.sources=./env/deploy/ -Dsonar.host.url=$HOST
  • Languages of the repository: XML, JS
  • Error observed:
    I need to get the quality gate status from the Web API.
    I followed this documentation awsdoc to setup the AWS CodeBuild
    I’m not able to get the project status
  • Steps to reproduce
    Run the following command: curl https://sonarcloud.io/api/qualitygates/project_status?projectKey=$Project >result.json
    The result is: {"errors":[{"msg":"Insufficient privileges"}]}
    So I tried with curl --user USER:PASS https://sonarcloud.io/api/qualitygates/project_status?projectKey=$Project >result.json
    where the USER and PASS are the same values of the User that created the organization and the project
    The result is empty, I mean 0 Byte returned.
    I saw in the API doc that the user need permissions and it has those pemissions

What I’m doing wrong?

Regards

Hi @Igor_Ferretti,

What’s the HTTP response status code you get for the second request? Can you try to send the request in Postman?

Fan

Hi @Fan_Yang ,
I was able to fix it adding the “-u $TOKEN” in the curl.

At first I wasn’t able to find any documentation about the private projects.

Regards

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.