| Info | ||||
|---|---|---|---|---|
| ||||
|
Get a List of Resources
| Description | Get a list of resources |
URL | /api/resources |
| HTTP Method | GET |
| Response Formats | json | xml |
Security | Requires User role on resource |
...
Parameter | Description | Required | Default Value | Example Values |
|---|---|---|---|---|
resource | id or key of the resource | No | None | org.codehaus.sonar:sonar |
metrics | Comma-separated list of metric keys/ids. | No | None | lines,blocker_violations |
depth | Used only when resource is set.
| No | 0 | -1 |
scopes | Comma-separated list of scopes:
| No | None | PRJ,DIR |
qualifiers | Comma-separated list of qualifiers:
| No | None | TRK,BRC |
verbose | Add some data to response. | No | false | true |
limit | Limit the number of results. Only used if one metric, and only one, is set. | No | None | 10 |
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 | true |
includealerts | Include alerts data: add nodes <alert> (ERROR, WARN, OK) and <alert_text> | No | false | true |
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 | true |
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 | BLOCKER,CRITICAL |
| format | Response formats. Possible values: json | xml | No | None | json |
Search Resources by Name
| Description | Search resources by name |
URL | /api/resources/search |
| HTTP Method | GET |
| Response Formats | json |
Security | Requires User role on resources |
Examples
| Use Case | Example Request |
|---|---|
| Get all the projects and sub-projects with name containing 'com' |
|
Response Format
| Code Block | ||||
|---|---|---|---|---|
| ||||
{
"total":325,
"page":1,
"page_size":10,
"data":[
{
"id":48209,
"nm":"Commons IO",
"q":"TRK"
},
{
"id":74793,
"nm":"Commons BCEL",
"q":"TRK"
},
...
]
} |
Parameters
Parameter | Description | Required | Default Value | Example Values |
|---|---|---|---|---|
s | String to look for. | No | None | com |
q | Comma-separated list of qualifiers:
| No | None | TRK,BRC |
| ps | Page size: number of results returned by page. | No | 10 | 5 |
| p | Page to return. | No | 1 | 2 |
| format | Response formats. Possible values: json | No | None | json |

