Get a List of Issues

DescriptionGet a list of issues

URL

/api/issues/search

HTTP MethodGET
Response Formatsjson | xml

Security

Requires Browse permission on project(s)

Available sinceVersion 3.6

Examples

Use CaseExample Request
Get all the issue from project SonarQubeand its sub-components (key = org.codehaus.sonar:sonar)

GET http://nemo.sonarsource.org/api/issues/search?componentRoots=org.codehaus.sonar:sonar

Get all the issues against the squid:AvoidCycles rule on the SonarQube instance

GET http://nemo.sonarsource.org/api/issues/search?rules=squid:AvoidCycles

Response Format

{

    "securityExclusions": false,
    "maxResultsReached": false,
    "paging": {
        "pageIndex": 1,
        "pageSize": 5,
        "total": 206,
        "pages": 42
    },
    "issues": [
        {
            "key": "01fc972e-2a3c-433e-bcae-0bd7f88f5123",
            "component": "com.github.kevinsawicki:http-request:com.github.kevinsawicki.http.HttpRequest",
            "project": "com.github.kevinsawicki:http-request",
            "rule": "checkstyle:com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck",
            "status": "RESOLVED",
            "resolution": "FALSE-POSITIVE",
            "severity": "MINOR",
            "message": "'3' is a magic number.",
            "line": 530,
            "author": "Developer 1",
            "creationDate": "2013-05-13T17:55:39+0200",
            "updateDate": "2013-05-13T17:55:39+0200",
            "comments": [
                {
                    "key": "7d7c56f5-7b5a-41b9-87f8-36fa70caa5ba",
                    "login": "admin",
                    "htmlText": "foooooo",
                    "createdAt": "2013-05-13T18:08:34+0200"
                }
            ]
        },
        ...
    ],
    "components": [
        {
            "key": "com.github.kevinsawicki:http-request:com.github.kevinsawicki.http.HttpRequest",
            "qualifier": "CLA",
            "name": "HttpRequest",
            "longName": "com.github.kevinsawicki.http.HttpRequest"
        },
        ...
    ],
    "projects": [
        {
            "key": "com.github.kevinsawicki:http-request",
            "qualifier": "TRK",
            "name": "http-request",
            "longName": "http-request"
        },
        ...
    ],
    "rules": [
        {
            "key": "checkstyle:com.puppycrawl.tools.checkstyle.checks.coding.MagicNumberCheck",
            "name": "Magic Number",
            "desc": "Checks for magic numbers.",
            "status": "READY"
        },
        ...
    ],
    "users": [
        {
            "login": "admin",
            "name": "Administrator",
            "active": true,
            "email": admin@sonarqube.org
        }
    ]

}

If the number of issues is greater than 10,000, only the first 10,000 ones are returned by the web service.

Parameters

Parameter

Description

Required

Default Value

Example Value

issues

Comma-separated list of issue keys.

No

None

5bccd6e8-f525-43a2-8d76-fcb13dde79ef
severities

Comma-separated list of severities.

Possible values: BLOCKER | CRITICAL | MAJOR | MINOR | INFO

NoNoneBLOCKER,CRITICAL
statuses

Comma-separated list of statuses.

Possible values: OPEN | REOPENED | CONFIRMED | RESOLVED | CLOSED

NoNoneOPEN,REOPENED
resolutions

Comma-separated list of resolutions.

Possible values: FIXED,REMOVED,FALSE-POSITIVE

NoNoneFIXED,REMOVED
resolved

To match resolved or unresolved issues.

Possible values: true | false

NoNonetrue
componentsTo retrieve issues associated to a specific list of components (comma-separated list of component keys). Note that if you set the value to a project key, only issues associated to this project are retrieved. Issues associated to its sub-components (such as files, packages, etc.) are not retrieved. See also componentRoots.NoNoneorg.apache.struts:struts:org.apache.struts.Action
componentRootsTo retrieve issues associated to a specific list of components and their sub-components (comma-separated list of component keys). Views are not supported.NoNoneorg.apache.struts:struts
rules

Comma-separated list of coding rule keys.

Format is <repository>:<rule>

NoNonesquid:AvoidCycles
actionPlansComma-separated list of action plan keys (not names).NoNone3f19de90-1521-4482-a737-a311758ff513
planned

To retrieve issues associated to an action plan or not.

Possible values: true | false

NoNonetrue
reportersComma-separated list of reporter logins.NoNoneadmin
assigneesComma-separated list of assignee logins.NoNoneadmin,usera
assigned

To retrieve assigned or unassigned issues.

Possible values: true | false

NoNonetrue
createdAfter

To retrieve issues created after the given date (inclusive).

Format: date or datetime ISO formats

NoNone2013-05-01 (or 2013-05-01T13:00:00+0100)
createdBefore

To retrieve issues created before the given date (exclusive).

Format: date or datetime ISO formats

NoNone2013-05-01 (or 2013-05-01T13:00:00+0100)
pageSize

Maximum number of results per page.

Default value: 100 (except when the 'components' parameter is set, value is set to "-1" in this case)

If set to "-1", the max possible value is used.

NoNone50
pageIndex

Index of the selected page

Default value: 1

NoNone2
format

Response format can be set through:

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

Assign/Unassign an Issue

DescriptionAssign/Unassign an issue

URL

/api/issues/assign

HTTP MethodPOST

Security

Requires authentication and Browse permission on project

Available sinceVersion 3.6

Examples

Use CaseExample Request
Assign the 'ac539576-df80-4a1f-9631-991b31ad27ef' issue to the 'admin' user

curl -X POST -v -u admin:admin 'http://localhost:9000/api/issues/assign?issue=ac539576-df80-4a1f-9631-991b31ad27ef&assignee=admin'

Unassign the 'ac539576-df80-4a1f-9631-991b31ad27ef' issue

curl -X POST -v -u admin:admin 'http://localhost:9000/api/issues/assign?issue=ac539576-df80-4a1f-9631-991b31ad27ef'

Parameters

Parameter

Description

Required

Default Value

Example Value

issue

Key of the issue.Yes

None

5bccd6e8-f525-43a2-8d76-fcb13dde79ef
assignee

Login of the assignee.

NoNoneadmin

Add a Comment

DescriptionAdd a comment

URL

/api/issues/add_comment

HTTP MethodPOST

Security

Requires authentication and Browse permission on project
Available sinceVersion 3.6

Examples

Use CaseExample Request
The 'admin' user adds the following comment to the 'ac539576-df80-4a1f-9631-991b31ad27ef' issue: 'blabla...'

curl -X POST -v -u admin:admin 'http://localhost:9000/api/issues/add_comment?issue=ac539576-df80-4a1f-9631-991b31ad27ef&text=blabla...'

Parameters

Parameter

Description

Required

Default Value

Example Value

issue

Key of the issue.Yes

None

5bccd6e8-f525-43a2-8d76-fcb13dde79ef
text

Comment.

YesNoneblabla...

Delete a Comment

DescriptionDelete a comment

URL

/api/issues/delete_comment

HTTP MethodPOST

Security

Requires authentication and Browse permission on project
Available sinceVersion 3.6

Examples

Use CaseExample Request

The 'admin' user deletes the following comment:  '392160d3-a4f2-4c52-a565-e4542cfa2096'

curl -X POST -v -u admin:admin 'http://localhost:9000/api/issues/delete_comment?key=392160d3-a4f2-4c52-a565-e4542cfa2096'

Parameters

Parameter

Description

Required

Default Value

Example Value
keyKey of the comment.Yes

None

392160d3-a4f2-4c52-a565-e4542cfa2096

Edit a Comment

DescriptionEdit a comment

URL

/api/issues/edit_comment

HTTP MethodPOST

Security

Requires authentication and User role on project
Available sinceVersion 3.6

Examples

Use CaseExample Request

The 'admin' user edits the following comment:  '392160d3-a4f2-4c52-a565-e4542cfa2096', new comment: 'blabla2...'

curl -X POST -v -u admin:admin 'http://localhost:9000/api/issues/edit_comment?key=392160d3-a4f2-4c52-a565-e4542cfa2096&text=blabla2...'

Parameters

Parameter

Description

Required

Default Value

Example Value
keyKey of the comment.Yes

None

392160d3-a4f2-4c52-a565-e4542cfa2096
textNew comment.Yes

None

blabla2...

Change Severity

DescriptionChange severity

URL

/api/issues/set_severity

HTTP MethodPOST

Security

Requires authentication and Browse permission on project
Available sinceVersion 3.6

Examples

Use CaseExample Request

Change the severity of the following issue to BLOCKER: ac539576-df80-4a1f-9631-991b31ad27ef

curl -X POST -v -u admin:admin 'http://localhost:9000/api/issues/set_severity?issue=ac539576-df80-4a1f-9631-991b31ad27ef&severity=BLOCKER'

Parameters

Parameter

Description

Required

Default Value

Example Value
issueKey of the issue.Yes

None

392160d3-a4f2-4c52-a565-e4542cfa2096
severity

New severity.

Possible values: BLOCKER | CRITICAL | MAJOR | MINOR | INFO

Yes

None

BLOCKER

Plan/Unplan an Issue

DescriptionPlan/Unplan an issue

URL

/api/issues/plan

HTTP MethodPOST

Security

Requires authentication and Browse permission on project
Available sinceVersion 3.6

Examples

Use CaseExample Request

Plan the 'ac539576-df80-4a1f-9631-991b31ad27' issue to the '3f19de90-1521-4482-a737-a311758ff513' action plan

curl -X POST -v -u admin:admin 'http://localhost:9000/api/issues/plan?issue=ac539576-df80-4a1f-9631-991b31ad27ef&plan=3f19de90-1521-4482-a737-a311758ff513'

Unplan the 'ac539576-df80-4a1f-9631-991b31ad27' issue

curl -X POST -v -u admin:admin 'http://localhost:9000/api/issues/plan?issue=ac539576-df80-4a1f-9631-991b31ad27ef'

Parameters

Parameter

Description

Required

Default Value

Example Value
issueKey of the issue.Yes

None

392160d3-a4f2-4c52-a565-e4542cfa2096
planKey of the action plan.No

None

3f19de90-1521-4482-a737-a311758ff513

Do Workflow Transition on an Issue

DescriptionDo workflow transition on an issue

URL

/api/issues/do_transition

HTTP MethodPOST

Security

Requires authentication and Browse permission on project
Available sinceVersion 3.6

Examples

Use CaseExample Request

Reopen the 'ac539576-df80-4a1f-9631-991b31ad27' issue

curl -X POST -v -u admin:admin 'http://localhost:9000/api/issues/do_transition?issue=ac539576-df80-4a1f-9631-991b31ad27ef&transition=reopen'

Parameters

Parameter

Description

Required

Default Value

Example Value
issueKey of the issue.Yes

None

392160d3-a4f2-4c52-a565-e4542cfa2096
transition

Transition.

Possible values: resolve | confirm | reopen | unconfirm | falsepositive

Yes

None

reopen

Get Possible Workflow Transitions for an Issue

DescriptionGet Possible Workflow Transitions for an Issue

URL

/api/issues/transitions

HTTP MethodGET

Security

Requires Browse permission on project

Available sinceVersion 3.6

Examples

Use CaseExample Request

Get the possible workflow transitions for the following issue: 'ac539576-df80-4a1f-9631-991b31ad27'

GET http://localhost:9000/api/issues/transitions?issue=ac539576-df80-4a1f-9631-991b31ad27ef 

Response Format

{"transitions":["confirm","resolve","falsepositive"]}

Parameters

Parameter

Description

Required

Default Value

Example Value
issueKey of the issue.Yes

None

392160d3-a4f2-4c52-a565-e4542cfa2096

Create a Manual Issue

DescriptionCreate a manual issue

URL

/api/issues/create

HTTP MethodPOST

Security

Requires authentication and Browse permission on project

Available sinceVersion 3.6

Examples

Use CaseExample Request

The 'admin' user creates a new manual issue:

  • Component: commons-io:commons-io:org.apache.commons.io.filefilter.OrFileFilter
  • Manual rule: manual:performance
  • Line: 2
  • Severity: BLOCKER
  • Description: blabla

curl -X POST -v -u admin:admin 'http://localhost:9000/api/issues/create?component=myproject:myfile&rule=manual:performance&line=2&severity=BLOCKER&message=blabla'

Parameters

Parameter

Description

Required

Default Value

Example Value
componentKey of the component on which to log the issue.Yes

None

org.apache.struts:struts:org.apache.struts.Action
rule

Manual rule key.

YesNonemanual:performance
severity

Severity of the issue.

Possible values: BLOCKER | CRITICAL | MAJOR | MINOR | INFO

NoMAJORBLOCKER
line

Line on which to log the issue.

If no line is specified, the issue is attached to the component and not to a specific line.

NoNone15
messageDescription of the issue.NoNoneblabla...

Bulk Change on Issues

DescriptionBulk change on issues

URL

/api/issues/bulk_change

HTTP MethodPOST

Security

Requires authentication and User role on project(s)

Available sinceVersion 3.7

Examples

Use CaseExample Request
Confirm issues f9a8464f-4252-47f9-9341-b350ce342d3a and 2f0f68e5-d13a-4e62-9255-c9482827d28b and assign them to "admin"

curl -X POST -v -u admin:admin 'http://localhost:9000/api/issues/bulk_change?issues=f9a8464f-4252-47f9-9341-b350ce342d3a,2f0f68e5-d13a-4e62-9255-c9482827d28b&actions=transition,assign&assign.assignee=admin&do_transition.transition=confirm'

Parameters

Parameter

Description

Required

Default Value

Example Value
issuesComma-separated list of issue keys.Yes

None

01fc972e-2a3c-433e-bcae-0bd7f88f5123,
01fc972e-2a3c-433e-bcae-0bd7f88f9999
actions

Comma-separated list of actions to perform.

Possible values: assign | set_severity | plan | do_transition

YesNoneassign,plan
assign.assignee

To assign the list of issues to a specific user (login), or unassign all the issues.

NoNonesbrandhof
set_severity.severity

To change the severity of the list of issues.

Possible values: BLOCKER | CRITICAL | MAJOR | MINOR | INFO

NoNoneBLOCKER
plan.planTo plan the list of issues to a specific action plan (key), or unlink all the issues from an action plan.NoNone3f19de90-1521-4482-a737-a311758ff513
do_transition.transitionPossible values: resolve | confirm | reopen | unconfirm | falsepositiveNoNoneconfirm
commentTo add a comment to a list of issuesNoNoneblabla...
sendNotifications

Possible values: true | false

Available since version 4.0.

Nofalsetrue