Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Info
iconfalse
titleTable of Contents

Table of Contents
maxLevel1

Get a List of Manual Measures

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'

GET http://localhost:9000/api/manual_measures?resource=myProject

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

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

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
format

Response format can be set through:

  • Parameter format: json
  • Or the 'Accept' property in the HTTP header:
    • Accept:application/json
If nothing is set, json is used.
NoNonejson

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

  • Description: myDescription

curl -u admin:admin -d "resource=myProject&metric=business_value&val=5000&desc=myDescription" 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)None10.0
textText value of the manual measureYes (or val is set)Noneabc
descDescriptionNoNonemyDescription

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'

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