Versions Compared

Key

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

...

DescriptionGet a list of reviews

URL

/api/reviews

HTTP MethodGET
Response Formatsjson | xml

Security

Requires User role on the project

Number or ResultsResults are limited to 200 reviews, ordered by creation date (most recent to oldest)

ExamplesExamples

Use CaseExample Request
Get reviews whose ids are 47 and 48

...

...

languagenone

GET

...

http://nemo.sonarsource.org/api/reviews?ids=47,48

Get all the open reviews on project Sonar (key = org.codehaus.sonar:sonar

...

languagenone

...

Response Format

Code Block
titleJSON
languagejavascript
[
  {
    "id":48,
    "createdAt":"2011-05-28T22:17:55+0000",
    "updatedAt":"2012-03-08T08:35:35+0000",
    "author":"evgeny.mandrikov",
    "assignee":"evgeny.mandrikov",
    "title":"Substitute calls to size() == 0 (or size() != 0) with calls to isEmpty()",
    "status":"CLOSED",
    "severity":"MINOR",
    "resource":"org.codehaus.sonar.plugins:sonar-dbcleaner-plugin:org.sonar.plugins.dbcleaner.purges.PurgeOrphanResources",
    "line":45,
    "violationId":41804608,
    "comments":[
      {
        "id":62,
        "author":"evgeny.mandrikov",
        "updatedAt":"2011-05-28T22:17:55+0000",
        "text":"Indeed - why not."
      },
      ...
    ]
  },
  ...
]

Parameters

Parameter

Description

Required

Default valueValue

Example Value

ids

List of review ids

No

None

3245,3251

resources

Comma-separated list of resource ids or keys

No

None

org.codehaus.sonar:sonar-application:org.sonar.application.StartServer

projects

Comma-separated list of root project ids or keys

No

None

org.codehaus.sonar:sonar

statuses

Comma-separated list of status
Possible values: OPEN | CLOSED 

No

None

OPEN,CLOSED

resolutions

Comma-separated list of resolutions
Possible values: FIXED | FALSE-POSITIVE  

No

None

FIXED,FALSE-POSTIVE

severities

Comma-separated list of severities
Possible values: INFO | MINOR | MAJOR | CRITICAL | BLOCKER

No

None

BLOCKER,CRITICAL

authors

Comma-separated list of author login 

No

None

admin,simon.brandhof

assignees

Comma-separated list of assignee login

No

None

admin,simon.brandhof

review_type

Type of review
Possible values: FALSE-POSITIVE | VIOLATION 

No

VIOLATION

VIOLATION,FALSE-POSITIVE

output

Format of comments
Possible values: PLAIN| HTML

No

PLAIN

HTML
formatResponse format: xml or jsonNoxmljson

Notes

Results are limited to 200 reviews, ordered by creation date (most recent to oldest).

Create a Review

DescriptionCreate an review

URL

/api/reviews

MethodPOST
Security

Requires authentication

Examples

Use CaseExample Request
Create a review on

...

violation of id '123':
  • Status: OPEN
  • Assignee: admin
  • Comment: myComment

...

languagenone

curl

...

-u

...

admin:admin

...

-d

...

"violation_id=123&status=OPEN&comment=myComment&assignee=admin"

...

-X

...

POST

...

http://localhost:9000/api/reviews

Parameters

Parameter

Description

Required

Default ValueExample Value

violation_id

Violation on which the review should be created

Yes

None123

status

Initial status (can be 'OPEN' or 'RESOLVED')

Yes

NoneOPEN

comment

Text of initial comment

No

NoneMy comment

resolution

If status 'RESOLVED', then resolution must be provided (can be 'FIXED' or 'FALSE-POSITIVE')

No

NoneFIXED

assignee

Login of initial assignee

No

Nonesimon.brandhof

Add a Comment on a Review

DescriptionAdd a comment

URL

/api/reviews/add_comment

MethodPUT
Security

Requires authentication

Examples

Use CaseExample Request
Add the following comment on

...

review of id '345': 'myComment'

...

languagenone

curl

...

-u

...

admin:admin

...

-d

...

"id=345&comment=myComment"

...

-X

...

PUT

...

http://localhost:9000/api/reviews/add_comment

Parameters

Parameter

Description

Required

Default ValueExample Value

id

Review id

Yes

None345

comment

New comment

Yes

NoneMy comment

Reassign a Review

DescriptionReassign a review

URL

/api/reviews/reassign

MethodPUT
Security

Requires authentication

Examples

Use CaseExample Request
Reassign

...

review of id '345' to user 'admin'

...

...

languagenone

curl

...

-u

...

admin:admin

...

-d

...

"id=345&assignee=admin"

...

-X

...

PUT

...

http://localhost:9000/api/reviews/reassign

Parameters

Parameter

Description

Required

Default ValueExample Value

id

Review id

Yes

None345

assignee

Login of new assignee

Yes

Nonesimon.brandhof

Resolve a Review

DescriptionResolve a review

URL

/api/reviews/resolve

MethodPUT
Security

Requires authentication

Examples

Use CaseExample Request
Flag

...

review of id '345' as false-positive

...

...

languagenone

curl

...

-u

...

admin:admin

...

-d

...

"id=345&resolution=FALSE-POSITIVE&comment=myComment"

...

-X

...

PUT

...

http://localhost:9000/api/reviews/resolve

Parameters

Parameter

Description

Required

Default ValueExample Value

id

Review id

Yes

None345
resolutionCan be 'FIXED' or 'FALSE-POSITIVE'

Yes

NoneFIXED

comment

 
Comment on the resolution

No

NoneMy comment

Reopen a Review

DescriptionReopen a review

URL

/api/reviews/reopen

MethodPUT
Security

Requires authentication

Examples

Use CaseExample Request
Reopen

...

review of id '345'

...

...

languagenone

curl

...

-u

...

admin:admin

...

-d

...

"id=345&comment=myComment"

...

-X

...

PUT

...

http://localhost:9000/api/reviews/reopen

Parameters

Parameter

Description

Required

Default ValueExample Value

id

Review id

Yes

None345

comment 

Comment on the reopen action

No

NoneMy comment