| Description | Get a list of resources |
URL | /api/resources |
| HTTP Method | GET |
| Response Formats | json | xml |
Security | Requires User role on resource |
Examples
| Use Case | Example Request |
|---|---|
| Get all the projects |
|
| For each project, get lines of code and code coverage measures |
|
| Get lines of code and code coverage measures for project org.codehaus.sonar:sonar | GET http://nemo.sonarsource.org/api/resources?resource=org.codehaus.sonar:sonar&metrics=ncloc,coverage |
| Get all the resources included in project org.codehaus.sonar:sonar: packages, files, etc. | GET http://nemo.sonarsource.org/api/resources?resource=org.codehaus.sonar:sonar&depth=-1 |
| Get all the files included in project org.codehaus.sonar:sonar |
|
| Hotspot of the ten files with the worst code coverage for project org.codehaus.sonar:sonar |
|
| Get lines of code measure of direct children of org.codehaus.sonar:sonar |
|
Parameters
Parameter | Description | Required | Default Value | Values |
|---|---|---|---|---|
resource | id or key of the resource | No | ||
metrics | Comma-separated list of metric keys/ids. | No | lines,blocker_violations | |
depth | Used only when resource is set.
| No | 0 | |
scopes | Comma-separated list of scopes:
| No | ||
qualifiers | Comma-separated list of qualifiers:
| No | ||
verbose | Add some data to response. | No | false | |
limit | Limit the number of results. Only used if one metric, and only one, is set. | No | ||
includetrends | Include trends and period variations in response: add <trend> (1 if better, else worse), <var> (1 if measure value increases) and nodes <p*> for period variations. | No | false | |
includealerts | Include alerts data: add nodes <alert> (ERROR, WARN, OK) and <alert_text> | No | false | |
rules | Filter on rules: setting it to true will return rules id and rule name for measure having such info (such as 'blocker_violations', 'critical_violations', ..., 'new_blocker_violations', ...) | No | false | |
rule_categories | Filter on rule ISO categories: setting it to true will return rules category id and rule category name for measure having such info (such as 'blocker_violations', 'critical_violations', ..., 'new_blocker_violations', ...) | No | false | |
rule_priorities | Filter on rule priority: setting it to true or to a list of priorities (BLOCKER, CRITICAL, MAJOR, MINOR, INFO) will return measures having such info (such as 'blocker_violations', 'critical_violations', ..., 'new_blocker_violations', ...). | No | false | |
| format | Response formats: xml or json | No | xml |

