| Table of Contents |
Get a List of Metrics
| Description | Get a list of metrics |
URL | /api/metrics |
| Method | GET |
Security | None |
Examples
Get all the metrics from the Sonar Nemo instance:
Get the metric 'Lines of Code' (id = ncloc):
Parameters
Parameter | Description | Required | Default Value | Value |
|---|---|---|---|---|
id | id or key of the project | No. Get all metrics if not set | None | ncloc |
| format | Response formats: xml or json | No | xml |
Create a Metric
| Description | Create a metric |
URL | /api/metrics |
| Method | POST |
| Security | Requires Global Administrator role to create a metric |
Examples
- Create a metric:
- Category: Alert
- Name: myAlertName
Description: myAlertDescription
Parameters
Parameter | Description | Required | Default Value |
|---|---|---|---|
id | id of the metric | Yes | None |
description | Description of the metric |
| None |
direction | Possible values: -1, 0, 1 | None | |
domain |
| None | |
| name | None | ||
qualitative | Is it a qualitative metric? | None | |
| val_type | Value type. | None | |
| user_defined | Can user fill measures online? Possible values: true, false | None |

