I am trying to get quality gate status from sonar server using API by passing pull request ID but I am getting error:

$QualityGateResult = Invoke-RestMethod -Method Get -Uri 
"$ServerUrl/api/qualitygates/project_status?pullRequest=$pullrequest_key?api- 
  version=6.0" 
-Headers $Headers
 $QualityGateResult | ConvertTo-Json | Write-Host

  if ($QualityGateResult.projectStatus.status -eq "OK"){
  Write-Host "Quality Gate Succeeded"
   }
  else{
  throw "Quality gate failed. Please check and fix the issues by reviewing the same."
   }

Error msg: Invoke-RestMethod : {"errors":[{"msg":"Either \u0027analysisId\u0027, \u0027projectId\u0027 or \u0027projectKey\u0027 must be provided"}]}

Please help us to understand where I am making mistake.

0

There are 0 answers