Versions Compared

Key

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

Table of Contents
maxLevel1

Get a List of Metrics

DescriptionGet a list of metrics

URL

/api/metrics

HTTP MethodGET
Response Formatsjson | xml

Security

None

 

Examples

Use CaseExample Request
Get all the metrics from the Sonar Nemo instance

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

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

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

...

Parameter

Description

Required

Default Value

Example Value

id

id or key of the metric

No. Get all metrics if not set

None

ncloc

formatResponse format.
Possible values: xml | json
NoNonejson

Create a Metric

DescriptionCreate a metric

URL

/api/metrics

HTTP MethodPOST
Security

Requires Global Administrator role

Examples

Use CaseExample Request
Create a metric

?Q?

Parameters

Parameter

Description

Required

Default ValueExample Value

description

Description of the metric

 

NoneMy metric blabla

direction

Possible values: -1 | 0 | 1

 None-1

domain

Domain of the metric

 NoneSize
nameName of the metricYesNonemyMetric

qualitative

Is it a qualitative metric?
Possible values: 0 | 1

 None1
val_type

Value type.
Possible values: PERCENT | INT | FLOAT | STRING | BOOL | MILLISEC

YesNonePERCENT
user_definedCan user fill measures online?
Possible values: true | false 
Nofalsetrue

Update a Metric

DescriptionUpdate a metric

URL

/api/metrics

HTTP MethodPUT
Security

Requires Global Administrator role

Examples

Use CaseExample Request
Create a metric

?Q?

Parameters

?Q?

...

DescriptionDelete a metric

URL

/api/metrics

HTTP MethodDELETE
Security

Requires Global Administrator role

Examples

Use CaseExample Request
Delete metric 'myMetric'

curl -u admin:admin -X DELETE http://localhost:9000/api/metrics/myMetric

Parameters

Parameter

Description

Required

Default ValueExample Value
idid of the metricYesNonemyMetric