This version of the SonarQube documentation is no longer maintained. It relates to a version of SonarQube that is not active.

See latest version
Start Free
10.0 | Extension Guide | Web API

Web API

On this page

Documentation

SonarQube provides web API to access its functionalities from applications. The web services composing the web API are documented within SonarQube, by URL. You can also access the web API documentation from the top bar in SonarQube:

screenshot showing how to access the Web API documentation on the SQ interface

Authentication

Administrative web services are secured and require the user to have specific permissions. In order to be authenticated, the user must provide credentials as described below.

User token

This is the recommended way. Benefits are described on the page Generating and using tokens.

SonarQube supports the bearer authentication scheme: 

curl --header 'Authorization: Bearer MY_TOKEN' https://sonarqube.com/api/user_tokens/search

Alternatively, you can use the basic scheme with an empty password:

# note that the colon after the token is required in curl to set an empty password 
curl -u THIS_IS_MY_TOKEN: https://sonarqube.com/api/user_tokens/search

HTTP Basic Access

Login and password are sent via the standard HTTP Basic fields:

curl -u MY_LOGIN:MY_PASSWORD https://sonarqube.com/api/user_tokens/search

Users who authenticate in the web application through an OAuth provider, for instance, GitHub or Bitbucket, don't have credentials and can't use HTTP Basic mode. They must generate and use tokens.


Was this page helpful?

© 2008-2024 SonarSource SA. All rights reserved. SONAR, SONARSOURCE, SONARLINT, SONARQUBE, SONARCLOUD, and CLEAN AS YOU CODE are trademarks of SonarSource SA.

Creative Commons License