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
DescriptionGet a list of reviews

URL

/api/reviews

HTTP MethodGET
Response Formatsjson | xml

Security

Requires User role on the project

Examples

Use CaseExample Request
Get reviews whose ids are 47 and 48

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

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

GET http://nemo.sonarsource.org/api/reviews?projects=org.codehaus.sonar:sonar&statuses=OPEN

Response Format

JSON

Parameters

Parameter

Description

Required

Default Value

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

HTTP MethodPOST
Security

Requires authentication

Examples

Use CaseExample Request
Create a review on violation of id '123':
  • Status: OPEN
  • Assignee: admin
  • Comment: myComment

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

HTTP MethodPUT
Security

Requires authentication

Examples

Use CaseExample Request
Add the following comment on review of id '345': 'myComment'

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

HTTP MethodPUT
Security

Requires authentication

Examples

Use CaseExample Request
Reassign review of id '345' to user 'admin'

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

HTTP MethodPUT
Security

Requires authentication

Examples

Use CaseExample Request
Flag review of id '345' as false-positive

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

HTTP MethodPUT
Security

Requires authentication

Examples

Use CaseExample Request
Reopen review of id '345'

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
Labels
  • None