Automating project creation and import

When you have a large project base, it can be beneficial to automate project creation and import using the Web API.

If you’re getting started with Web APIs, see Web API.

Automating the local project creation

Only using the Web API POST /api/projects/create endpoint is enough to create a local project. A name and a project key are the only necessary parameters.

Automating the import of projects hosted on a DevOps platform

You can create a project in SonarQube and automatically bind it with a project in your DevOps platform using the Web API.

  • As an instance administrator, you must first configure your SonarQube instance with your DevOps platform. You can use the POST api/alm_settings/create_<yourPlatform> endpoint to create the integration or set it up in the SonarQube UI by going to Administration > Configuration > General Settings > DevOps Platform Integrations.

  • As a user, create a SonarQube project with the information from your DevOps platform project using the POST api/v2/dop-translation/bound-projects endpoint. Requirements:

    • Make sure you have the Create Project permissions.

    • Set a Personal Access Token using the POST api/alm_integrations/set_pat endpoint.

    • List all DevOps platform integrations to retrieve the information needed for the project creation endpoint parameters using the GET /api/v2/dop-translation/dop-settings endpoint.

Last updated

Was this helpful?