Getting error code 400 when using /api/ce/submit

Good Afternoon.

I am using the community edition of SonarQube 10.3
Its the windows standalone install

I am trying to add a build failure step in my Teamcity build config.
This step is supposed to check that a sonarqube project had completed it analysis and fail the build if the project hasnt passed.

I have tried this in a number of languages but it keeps failing when I try this API call

response = requests.post(f"{sonarqube_url}/api/ce/submit?projectKey={project_key}“, headers={“Authorization”: f"Bearer {auth_token}”})

The project has been scanned and it exists on the sonarqube server

This fails with an error code 400 when i step into the code it says that the report parameter is missing.

What am I doing wrong

Hi,

You don’t need to manually call api/ce/submit. The scanner does that for you at the end of analysis.

I think what you’re after is the Quality Gate analysis parameters to make the pipeline wait until server-side processing of the report is complete. Then a webhook to send the results.

Note that you’ll need to ‘catch’ and process the webhook manually since we don’t offer direct support of TeamCity.

 
HTH,
Ann