Full documentation for SonarQube has moved to a new location: http://docs.sonarqube.org/display/SONAR

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

DescriptionGet a list of manual measures

URL

/api/manual_measures

HTTP MethodGET
Response Formatsjson

Security

Requires User role on the project

Examples

Use CaseExample Request
Get all the manual measures on project 'myProject'

...

...

languagenone

GET

...

...

Get the manual measure on metric 'business_value' on project 'myProject'

...

languagenone

...

...

Response Format

Code Block
titleJSON
languagejavascript
[
  {
    "id":10,
    "metric":"business_value",
    "resource":"java-sonar-runner-simple",
    "val":10.2,
    "desc":"blabla",
    "created_at":"2012-10-10T18:12:23+0200",
    "updated_at":"2012-10-10T18:12:23+0200",
    "login":"admin",
    "username":"Administrator"
  },
  ...
]

Parameters

Parameter

Description

Required

Default Value

Example Value

resourceid or key of the projectYesNoneorg.codehaus.sonar:sonar
metricid of the manual metricNoNonebusiness_value
formatResponse formatsformat: jsonNo None json

Create a Manual Measure

DescriptionCreate a manual measure

URL

/api/manual_measures

HTTP MethodPOST
 Security

Requires Project Administrator role on the project

Examples

Use CaseExample Request
Create a manual measure on project 'myProject' being logged in as user 'admin/admin':
  • Manual metric: business_value
  • Value: 5000

...

languagenone

curl

...

-u

...

admin:admin

...

-d

...

"resource=myProject&metric=business_value&val=5000"

...

http://localhost:9000/api/manual_measures

Parameters

Parameter

Description

Required

Default Value

Example Value

resource

id or key of the project

Yes

None

org.codehaus.sonar:sonar

metric

Key of the manual metric

Yes

None

business_value 

val

Decimal value of the manual measure

Yes (or text is set)None 10.0
textText value of the manual measureYes (or val is set)None abc

Delete a Manual Measure

DescriptionDelete a manual measure

URL

/api/manual_measures

HTTP MethodDELETE
 Security

Requires Project Administrator role on the project

Examples

Use CaseExample Request
Delete manual measure 'business_value' on project 'myProject'

...

...

languagenone

curl

...

-u

...

admin:admin

...

-X

...

DELETE

...

"http://localhost:9000/api/manual_measures?resource=myProject&metric=business_value"

Parameters

Parameter

Description

Required

Default Value

Example Value

resource

id or key of the project

Yes

None

org.codehaus.sonar:sonar

metric

Key of the manual metric

Yes

None

business_value