| Description | Get a list of lines of source code |
URL | /api/sources |
| HTTP Method | GET |
| Response Formats | xml | json | txt |
Security | Requires User role on the project |
Examples
| Use Case | Example Request |
|---|---|
| Get source code of 'org.codehaus.sonar:sonar-plugin-api:org.sonar.api.measures.CoreMetrics' from line 10 to 20 |
...
...
| language | none |
|---|
|
...
Response Format
| Code Block | ||||
|---|---|---|---|---|
| ||||
[
{
"10":" *",
"11":" * Sonar is distributed in the hope that it will be useful,",
"12":" * but WITHOUT ANY WARRANTY; without even the implied warranty of",
...
}
] |
Parameters
Parameter | Description | Required | Default Value | Example Value |
|---|---|---|---|---|
resource | id or key of the resource | Yes | None | org.codehaus.sonar:sonar |
from | First line to display | No | None | 10 |
to | Last line to display (inclusive) | No | None | 20 |
color | Highlights code syntax if true. | No | false | true |
| format | Response formats: xml or json or txt | No | xmlNone | json |

