Full documentation for SonarQube has moved to a new location: http://docs.sonarqube.org/display/SONAR

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Use CaseExample Request
Get all the metrics from the SonarQube TM Nemo instance

GET http://nemo.sonarsource.org/api/metrics

Get the metric 'Lines of Code' (key = ncloc)

GET http://nemo.sonarsource.org/api/metrics/ncloc

...

Parameter

Description

Required

Default Value

Example Value

key

key of the metric

No. Get all metrics if not set

None

ncloc

format

Response format can be set through:

  • Parameter format: xml | json
  • Or the 'Accept' property in the HTTP header:
    • Accept:text/xml
    • Accept:application/json
If nothing is set, json is used.
NoNonejson

...

DescriptionCreate a manual metric

URL

/api/metrics

HTTP MethodPOST

Security

Requires authentication and Administer System Administrator rolepermission

Examples

Use CaseExample Request

Create a manual metric:

  • Key: foo
  • Name: bar
  • Value type: INT
  • Description: blabla
  • Domain: Size

curl -X POST -v -u admin:admin 'http://localhost:9000/api/metrics/foo?name=bar&val_type=INT&description=blabla&domain=Size'

...

DescriptionUpdate a manual metric

URL

/api/metrics

HTTP MethodPUT

Security

Requires authentication and Administer System Administrator rolepermission

Examples

Use CaseExample Request

Update the manual metric whose key is 'foo':

  • New name: bar
  • New value type: INT
  • New description: blabla
  • New domain: Size

curl -X PUT -v -u admin:admin 'http://localhost:9000/api/metrics/foo?name=bar&val_type=INT&description=blabla&domain=Size'

...

DescriptionDelete a manual metric

URL

/api/metrics

HTTP MethodDELETE

Security

Requires authentication and Administer System Administrator rolepermission

Examples

Use CaseExample Request

Delete the manual metric whose key is 'foo'.

curl -X DELETE -v -u admin:admin 'http://localhost:9000/api/metrics/foo'

...