Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

DescriptionGet a list of lines of source code

URL

/api/sources

HTTP MethodGET
Response Formatsxml | json | txt

Security

Requires Code Viewer role on the project

Examples

Use CaseExample Request
Get source code of 'org.codehaus.sonar:sonar-plugin-api:org.sonar.api.measures.CoreMetrics' from line 10 to 20

GET http://nemo.sonarsource.org/api/sources?resource=org.codehaus.sonar:sonar-plugin-api:org.sonar.api.measures.CoreMetrics&from=10&to=20

Response Format

JSON

Parameters

Parameter

Description

Required

Default ValueExample Value

resource

id or key of the resource

Yes

Noneorg.codehaus.sonar:sonar

from

First line to display

No

None10

to

Last line to display (inclusive)

No

None20

color

Highlights code syntax if true.
Possible values: true | false 

No

falsetrue
format

Response format can be set through:

  • Parameter format: xml | json | txt
  • Or the 'Accept' property in the HTTP header:
    • Accept:text/xml
    • Accept:application/json
If nothing is set, json is used.
NoNonejson
  • No labels