Create project and trigger Project analysis using WebAPI

  • I am currently using in SonarQube Community Edition.
  • I am trying to Create Project in SonarQube ,Import Code repo from Azure DevOps and Trigger Analysis all actions through Web API.
  • Created the Project using -api/projects/create Endpoint.
    Tried to import project code from azure DevOps using -api/alm_integrations/import_azure_project .
    Planning to use api/project_analyses/create_event to trigger analysis.

Please correct me on the below two understanding,

  1. api/alm_integrations/import_azure_project Endpoint will help me to get Code Repo from Azure DevOps to SonarQube.
  2. api/project_analyses/create_event help me to trigger Project analysis ?

Hey there.

Analyzing a project requires analyzing with a scanner, which is more involved than calling an API.

It sounds like you’ll want to use the SonarQube Extension for Azure DevOps

Hi Colin,
Thanks for coming back on this.
Yes, we have utilized the Azure DevOps Extensions for purpose of analysing the Project.
Now, we have requirement to do all these activities programmatically. With the help of API.
Please correct me on the below two understanding,

  1. api/alm_integrations/import_azure_project Endpoint will help me to get Code Repo from Azure DevOps to SonarQube.
  2. api/project_analyses/create_event help me to trigger Project analysis ?

or Please suggest me other approaches which will fit in our requirement.

thanks,
Praveen Desai

You can’t use an API to trigger project analysis – that’s just not how SonarQube works. You need to integrate with your CI pipeline.