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

violations

Get a list of violations on a given resource
Get all the violations of a project
Get the blocker and critical violations of a project

reviews

Get a list of reviews
Create a review
Update a review (add comment, reassign it, etc.)

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

Project Measures

Web Service

Examples of use cases that can be fulfilled

resources (Resource)

Search resources by name
Get a list of resources 

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

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

metrics

Get a list of metrics

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

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 favourites
Create a favourite
Delete a favourite

authentication

Check authentication

Administration

Web Service

Examples of use cases that can be fulfilled

projects

Delete a project

properties

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

server

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

updatecenter/installed_plugins

Get the list of all the plugins installed on the Sonar 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.

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.