Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info
iconfalse
titleTable of Contents

Table of Contents
maxLevel2

This page lists all the available Web Services to be used by any HTTP clients.

Available Web Services

Issues

Web Service

Examples of use cases that can be fulfilled

issues

Get a list of issues
Assign/Unassign as issue
Create a manual issue

rules

Get a list of rules

profiles

Get a list of profiles
Get the list of coding rules activated in a quality profile
Backup a quality profile
Restore a quality profile
Delete a profile
Set a profile as default

action_plans

Get a list of action plans
Create / Update / Delete an action plan
Close / Open an action plan

violations

Deprecated since version 3.6. Replaced by the issues web service.

reviews

Deprecated since version 3.6. Replaced by the issues web service.

Project Measures

Web Service

Examples of use cases that can be fulfilled

resources (Components)

Get a list of components

resources (Measures)Get the measures of a list of metrics on a given component
manual_measures

Get a list of manual measures
Create or update a manual measure
Delete a manual measure

metrics

Get a list of metrics
Create / Update / Delete a manual metric 

timemachine

Get past measures

sources

Get a list of lines from source files

events

Get a list of events from a project

User

Web Service

Examples of use cases that can be fulfilled

users

Get a list of users
Create a user
Update a user

user_properties

Get a list of user properties
Create a user property
Update a user property
Delete a user property

favourites

Get the logged in user's list of favorites
Create a favorite
Delete a favorite

authentication

Check authentication

permissionsAdd or remove user permissions

Administration

Web Service

Examples of use cases that can be fulfilled

projects

Delete a project
Provision a project 

properties

Get a list of properties
Create a property
Update a property
Delete a property

server

Get the status of the SonarQube server
Upgrade the SonarQube database
Get the system properties

updatecenter/installed_plugins

Get the list of all the plugins installed on the SonarQube instance

Response Formats

The API provides several response formats such as XML, JSON (ie. JavaScript Object Notation) plain text or CSV.

Check the available formats on the page of each web service.

HTTP Status Codes

HTTP Code

Description

200

OK

400

Bad request.
The request could not be understood by the server due to malformed syntax.

401

Unauthorized

403

Forbidden.
The request was a legal request, but the server is refusing to respond to it.

404

The requested resource could not be found.

500

Internal server error.

Authentication

...

Use Case

...

Example Request

...

Documentation in SonarQube 4.4+

Starting with SonarQube 4.4, the web application offers a built-in and always-up-to-date documentation of the Web Service API. The link to access it is located in the footer of the page:

Image Added

You can see it live on Nemo at http://nemo.sonarqube.org/api_documentation.

The following REST Web Services are not listed but are still availables : 

Calling a secured web service

Some web services (like administration ones) are secured and require credentials that can be passed using basic HTTP authentication.

Example with curl to get the server system properties with the user admin/admin

...

on your freshly installed SonarQube instance:


curl -u admin:admin http://localhost:9000/api/server/system

Note on information returned by web services

Some information documented in web services response examples depends on some plugins to be installed.

For instance :

  • the /api/issues/search web service returns the "author" information only when the Dev Cockpit plugin is installed
  • the /api/sources/scm returns information only when the SCM Activity plugin is installed

Documentation for older versions

For SonarQube < 4.4, see the archived documentation.