Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Table of Contents

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

Response Format

JSON

Parameters

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?


Delete a Metric

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
  • No labels