| Description | Get a list of violations |
URL | /api/violations |
| HTTP Method | GET |
| Response Formats | json | xml |
Security | Requires User role on project |
Examples
| Use Case | Example Request |
|---|---|
| Get all the violations from project Sonar (key = org.codehaus.sonar:sonar): |
|
| Get all the blocker and critical violations from project Sonar (key = org.codehaus.sonar:sonar): |
Parameters
Parameter | Description | Required | Default Value | Example Value |
|---|---|---|---|---|
resource | id or key of the resource. | Yes | None | org.codehaus.sonar:sonar |
depth | Used only when resource is set.
| No | 0 | -1 |
scopes | Comma-separated list of scopes:
| No | None | PRJ,FIL |
qualifiers | Comma-separated list of qualifiers:
| No | None | TRK,BRC |
rules | Comma-separated list of rule keys or ids. | No | None | squid:MethodCyclomatiComplexity,pmd:ConstructorCallsOverridableMethod |
priorities | Comma-separated list of priorities. | No | None | BLOCKER,CRITICAL |
limit | Maximum number of results | No | 5000 | 10 |
include_review | Include review data into response. | No | false | true |
output | Output format of review comments. Ignored if include_review is false. | No | PLAIN | HTML |
switched_off | If true, then return only switched-off violations (usually false-positives), | No | false | true |
| format | Response formats. Possible values: xml | json | No | None | json |

