...
| Description | Get a list of metrics |
URL | /api/metrics |
| HTTP Method | GET |
| Response Formats | json | xml |
Security | None |
Examples
| Use Case | Example Request |
|---|---|
| Get all the metrics from the Sonar Nemo instance |
...
...
| language | none |
|---|
|
...
| Get the metric 'Lines of Code' (id = ncloc) |
...
| language | none |
|---|
...
Response Format
| Code Block | ||||
|---|---|---|---|---|
| ||||
[
{
"key":"packages",
"name":"Packages",
"description":"Packages",
"domain":"Size",
"qualitative":false,
"user_managed":false,
"direction":-1,
"val_type":"INT",
"hidden":false
},
...
] |
Parameters
Parameter | Description | Required | Default Value | Example Value |
|---|---|---|---|---|
id | id or key of the projectmetric | No. Get all metrics if not set | None | ncloc |
| format | Response formatsformat. Possible values: xml or | json | No | xmlNone | json |
Create a Metric
| Description | Create a metric |
URL | /api/metrics |
| HTTP Method | POST |
| Security | Requires Global Administrator role |
Examples
| Use Case | Example Request |
|---|---|
| Create a metric |
...
?Q? |
...
...
???
| Code Block | ||
|---|---|---|
| ||
??????????????????????????????, |
Parameters
Parameter | Description | Required | Default Value | Example Value |
|---|---|---|---|---|
description | Description of the metric |
| None | My metric blabla |
direction | Possible values: -1 | 0 | 1 | None | -1 | |
domain | Domain of the metric | None | Size | |
| name | Name of the metric | Yes | None | myMetric |
qualitative | Is it a qualitative metric? | None | 1 | |
| val_type | Value type. | Yes | None | PERCENT |
| user_defined | Can user fill measures online? Possible values: true | false | No | false | true |
Update a Metric
| Description | Update a metric |
URL | /api/metrics |
| HTTP Method | PUT |
| Security | Requires Global Administrator role |
Examples
- Update metric 'myMetric':
- ???
- ???
???
Code Block language none ??????????????????????????????,
Parameters
Parameter | Description | Required | Default Value |
|---|---|---|---|
| id | id of the metric | Yes | None |
description | Description of the metric | No | None |
direction | Possible values: -1, 0, 1 | No | None |
domain |
| No | None |
| name | No | None | |
qualitative | Is it a qualitative metric? | No | None |
| val_type | Value type. | No | None |
| user_defined | Can user fill measures online? Possible values: true, false | No | None |
| Use Case | Example Request |
|---|---|
| Create a metric | ?Q? |
Parameters
?Q?
Delete a Metric
| Description | Delete a metric |
URL | /api/metrics |
| HTTP Method | DELETE |
| Security | Requires Global Administrator role |
Examples
| Use Case | Example Request |
|---|---|
| Delete metric 'myMetric' |
...
...
| language | none |
|---|
|
...
|
...
|
...
|
...
|
...
|
Parameters
Parameter | Description | Required | Default Value | Example Value |
|---|---|---|---|---|
| id | id of the metric | Yes | None | myMetric |

