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 5 Next »

Table of Contents

Get a List of Resources

DescriptionGet a list of resources

URL

/api/resources

MethodGET

Security

Requires User role on resources

Examples

  1. Get all the projects:



  2. For each project, get lines of code and code coverage measures:



  3. Get lines of code and code coverage measures for project org.codehaus.sonar:sonar:



  4. Get all the resources included in project org.codehaus.sonar:sonar: packages, files, etc.:



  5. Get all the files included in project org.codehaus.sonar:sonar:



  6. Hotspot of the ten files with the worst code coverage for project org.codehaus.sonar:sonar: 

Parameters

Parameter

Description

RequiredDefault ValueValues

resource

id or key of the resource

No  

metrics

Comma-separated list of metric keys/ids.
Load measures on selected metrics. If only one metric is set, then measures are ordered by value.

No lines,blocker_violations

depth

Used only when resource is set. 

  • 0: only selected resource 
  • -1: all children, including selected resource 
  • >0: depth toward the selected resource
No0 

scopes

Comma-separated list of scopes:

  • PRJ: project/module 
  • DIR: directory (like Java package) 
  • FIL: file
No  

qualifiers

Comma-separated list of qualifiers

  • TRK: project 
  • BRC: module 
  • CLA: class 
  • UTS: unit test 
  • DIR: directory 
  • FIL: file
No  

verbose

Add some data to response.
Possible values: true | false 

Nofalse 

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.
Possible values: true | false 

Nofalse 

includealerts

Include alerts data: add nodes <alert> (ERROR, WARN, OK) and <alert_text>
Possible values: true | false  

Nofalse 

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', ...)
Possible values: true | false | list of rule ids 

Nofalse 

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', ...)
Possible values: true | false | list of category ids  

Nofalse 

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', ...).
Possible values: true | false | list of priorities

Nofalse 

 

 

  • No labels