This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Issues in JIRA

The following operations are available for working with issues.Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with issues, see Sample configuration .

OperationDescription
getIssue Gets the specified issue.
createIssue

Creates a new issue.

updateIssue

Updates an issue.

updateIssueAssignee Assigns the issue to the specified user.
getTransitions Gets a list of transitions the current user can perform for an issue.
doTransition Performs a transition on an issue.
getComments Gets the comments for an issue.
postComment Posts a comment on an issue.
updateComment Updates an existing comment.
deleteComment Deletes an existing comment.
addAttachmentToIssueId Adds an attachment to an issue.
getIssuePriorities Gets the available priorities for issues.
getIssuePriorityById Gets information about a specific priority.
getIssueTypes Gets the available types of issues.
getIssueTypeById Gets information about a specific issue type.
getVotesForIssue Gets the votes for an issue.
createBulkIssueCreates many issues in one bulk operation.
assignIssueToUserAssigns an issue to a user. 
getCommentByIdRetrieves all comments for an issue.
sendNotificationSends a notification (e-mail) to the list or recipients defined in the request.
addVotesForIssueCasts your vote in favour of an issue.
getWatchersForIssueRetrieves the list of watchers for the issue with the given key.
removeUserFromWatcherListRemoves a user from an issue's watcher list.

Following is more information about these operations.

Getting an issue 

To get an existing issue, use getIssue and specify the issue ID.

getIssue
<jira.getIssue>
    <issueIdOrKey>{$ctx:issueIdOrKey}</issueIdOrKey>
    <fields>{$ctx:fields}</fields>
	<expand>{$ctx:expand}</expand>
</jira.getIssue>
Properties
  • issueIdOrKey: Identifies the issue to retrieve. This can be an issue ID, or an issue key.
  • fields : The list of fields to return for the issue.
  • expand : The parameters to expand.
Sample request

Following is a sample REST/JSON request that can be handled by the getDashboardById operation.

Sample request for getDashboardById
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",        
    "issueIdOrKey":"TEST-1"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e1160

Creating an issue

To create a new issue (or task), use createIssue and set the following properties.

createIssue
<jira.createIssue>
    <projectKey>{$ctx:projectKey}</projectKey>
    <issueFields>{$ctx:issueFields}</issueFields>
</jira.createIssue>
Properties
  • projectKey : The key (unique identifier) of the project in which you are creating the issue. 
  • issueFields: Fields of the issue.
Sample request

Following is a sample REST/JSON request that can be handled by the createIssue operation.

Sample request for createIssue
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",        
    "issueFields":{
        "fields": {
        	"project":{
                "key": "TEST1"
            },
            "summary": "Hello",
            "description": "test issue",
            "issuetype": {
                "id": "10006"
            }
        }
    }
}

Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e864

Updating an issue

To update an issue, use updateIssue, specify the issue ID.

updateIssue
<jira.updateIssue>
    <issueIdOrKey>{$ctx:issueIdOrKey}</issueIdOrKey>
	<issueFields>{$ctx:issueFields}</issueFields>
</jira.updateIssue>
Properties
  • issueIdOrKey: The key (unique identifier) of the issue. 
  • issueFields: Fields of the issue.
Sample request

Following is a sample REST/JSON request that can be handled by the updateIssue operation.

Sample request for updateIssue
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",        
    "issueIdOrKey":"TEST-6",
    "issueFields":{  
        "update":{  
            "summary":[  
               {  
                  "set":"Bug in business logic"
               }
            ],
            "labels":[  
               {  
                  "add":"triaged"
               },
               {  
                  "remove":"blocker"
               }
            ]
         }
    }
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e1209

Assigning an issue to another user

To assign an issue to another user, use updateIssueAssignee,  specify the issue ID

updateIssueAssignee
 <jira.updateIssueAssignee>
    <name>{$ctx:name}</name>
	<issueIdOrKey>{$ctx:issueIdOrKey}</issueIdOrKey>
</jira.updateIssueAssignee>
Properties
  • issueIdOrKey: Identifies the issue to update. This can be an issue ID, or an issue key.
  • name : The username of the user.
Sample request

Following is a sample REST/JSON request that can be handled by the updateIssueAssignee operation.

Sample request for updateIssueAssignee
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",        
    "name":"admin",       
    "issueIdOrKey":"TEST-2"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e924

Getting transitions

To get a list of the possible transitions the current user can perform for an issue, use getTransitions and  specify the issue ID.

getTransitions
<jira.getTransitions>
	<issueIdOrKey>{$ctx:issueIdOrKey}</issueIdOrKey>
    <expand>{$ctx:expand}</expand>
</jira.getTransitions>
Properties
  • issueIdOrKey: Identifies the issue to update. This can be an issue ID, or an issue key.
  • expand : The parameters to expand.
Sample request

Following is a sample REST/JSON request that can be handled by the getTransitions operation.

Sample request for getTransitions
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",             
    "issueIdOrKey":"TEST-2"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e1074

Performing transitions

To perform a transition on an issue, use doTransition, specify the issue ID, and include the transition ID along with any other updates you want to make using the following properties.

doTransition
 <jira.doTransition>
    <issueIdOrKey>{$ctx:issueIdOrKey}</issueIdOrKey>
    <issueFields>{$ctx:issueFields}</issueFields>
</jira.doTransition>
Properties
  • issueIdOrKey: Identifies the issue to update. This can be an issue ID, or an issue key.
  • issueFields: Fields of the issue.

Sample request

Following is a sample REST/JSON request that can be handled by the doTransitions operation.

Sample request for doTransitions
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",              
    "issueIdOrKey":"TEST-2"
    "issueFields":{
     "update": {
       "comment": [
               {
                   "add": {
                       "body": "Bug has been fixed."
                       }
               }
           ]
       },
      "transition": {
           "id": "11"
       }
   }
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e1097

Getting comments

To get the comments for an issue, use getComments and  specify the issue ID.

getComments
<jira.getComments>
    <issueIdOrKey>{$ctx:issueIdOrKey}</issueIdOrKey>
	<expand>{$ctx:expand}</expand>
</jira.getComments>
Properties
  • issueIdOrKey: Identifies the issue whose comments you want to get. This can be an issue ID, or an issue key.
  • expand : The parameters to expand.
Sample request

Following is a sample REST/JSON request that can be handled by the getComments operation.

Sample request for getComments
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",             
    "issueIdOrKey":"TEST-2"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e957

Posting a comment

To post a comment to an issue, use postComment and specify the following properties.

postComment
<jira.postComment>
    <issueIdOrKey>{$ctx:issueIdOrKey}</issueIdOrKey>
    <comment>{$ctx:comment}</comment>
	<visibleRole>{$ctx:visibleRole}</visibleRole>
    <expand>{$ctx:expand}</expand>
</jira.postComment>
Properties
  • issueIdOrKey: Identifies the issue to which you are adding this comment. This can be an issue ID, or an issue key.
  • Comment: The text to post as the comment.
  • visibleRole: User role that can view the comment.
  • expand : The parameters to expand.
Sample request

Following is a sample REST/JSON request that can be handled by the postComment operation.

Sample request for postComment
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",        
    "issueIdOrKey":"TEST-1",
    "comment":"Waiting to hear back from the legal department.",
    "visibleRole":"Administrators"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e978

Updating a comment

To update an existing comment, use updateComment operation. 

updateComment
<jira.updateComment>
    <commentId>{$ctx:commentId}</commentId>
    <issueIdOrKey>{$ctx:issueIdOrKey}</issueIdOrKey>
	<comment>{$ctx:comment}</comment>
	<visibleRole>{$ctx:visibleRole}</visibleRole>
</jira.updateComment>
Properties
  • issueIdOrKey : Identifies the issue whose comment you are updating. This can be an issue ID, or an issue key. If the issue cannot be found via an exact match, JIRA will also look for the issue in a case-insensitive way, or by looking to see if the issue was moved.
  • commentId : Identifies the comment you are updating.
  • comment : A string containing the comment to be posted
  • visibleRole: A String containing the visible role.
  • expand: The optional flags: renderedBody (provides body rendered in HTML).
Sample request

Following is a sample REST/JSON request that can be handled by the updateComment operation.

Sample request for updateComment
{
	"username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",
    "issueIdOrKey":"TEST-1",
    "commentId":"10100",
    "comment":"is this a bug?",
    "visibleRole":"Administrators"  
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e1035

Deleting a comment

To delete an existing comment, use deleteComment.

deleteComment
<jira.deleteComment>
    <issueIdOrKey>{$ctx:issueIdOrKey}</issueIdOrKey>
	<commentId>{$ctx:commentId}</commentId>
</jira.deleteComment>
Properties
  • issueIdOrKey: Identifies the issue whose comment you are deleting. This can be an issue ID, or an issue key.
  • commentId: Identifies the comment you are deleting.
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e1064

Adding attachments to an issue

To add one or more attachments to an issue, use addAttachmentToIssueId, specify the issue ID.

addAttachmentToIssueId
<jira.addAttachmentToIssueId>
  <issueIdOrKey>{$url:issueIdOrKey}</issueIdOrKey>
</jira.addAttachmentToIssueId>

Multipart processing

Multipart/form-data cannot be processed inside the ESB. Therefore, the ESB should be in a content-unaware status. To achieve this, configure a pass-through proxy, and then build the message from the client end and send it to the proxy.

Properties
  • issueIdOrKey: Identifies the issue to which you are adding attachments. This can be an issue ID, or an issue key.
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e3258

Getting priorities

To get the priorities available for issues, use getIssuePriorities. This operation returns detailed information about each priority, including its name, ID, and more.

getIssuePriorities
<jira.getIssuePriorities/>
Sample request

Following is a sample REST/JSON request that can be handled by the getIssuePriorities operation.

Sample request for getIssuePriorities
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e1817

Getting information on a priority

To get information on a specific priority, use getIssuePriorityById and specify the priority ID.

getIssuePriorityById
<jira.getIssuePriorityById>
	<issuePriorityId>{$ctx:issuePriorityId}</issuePriorityId>
</jira.getIssuePriorityById>
Properties
  • issuePriorityId: Identifies the priority whose information you want to retrieve.
Sample request

Following is a sample REST/JSON request that can be handled by the getIssuePriorityById operation.

Sample request for getIssuePriorityById
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",        
    "issuePriorityId":"1"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e1832

Getting issue types

To get the types of issues available in this JIRA instance, use getIssueTypes. This operation returns detailed information about each issue type, including its name, ID, and more.

getIssueTypes
<jira.getIssueTypes/>
Sample request

Following is a sample REST/JSON request that can be handled by the getIssueTypes operation.

Sample request for getIssueTypes
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e704

Getting information on an issue type

getIssueTypeById
<jira.getIssueTypeById>
	<issueTypeId>{$ctx:issueTypeId}</issueTypeId>
</jira.getIssueTypeById>

To get information on a specific issue type, use jira.getIssueTypeById and specify the type ID.

Properties
  • issueTypeId: Identifies the issue type whose information you want to retrieve.
Sample request

Following is a sample REST/JSON request that can be handled by the getIssueTypeById operation.

Sample request for getIssueTypeById
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",        
    "issueTypeId":"3"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e719

Getting votes for an issue

To get the votes for a specific issue, use getVotesForIssue and specify the issue ID. This operation returns a JSON representation of the vote information, including the number of votes and more.

getVotesForIssue
<jira.getVotesForIssue>
	<issueIdOrKey>{$ctx:issueIdOrKey}</issueIdOrKey>
</jira.getVotesForIssue>
Properties
  • issueIdOrKey: Identifies the issue whose votes you want to get. This can be an issue ID, or an issue key.
Sample request

Following is a sample REST/JSON request that can be handled by the getVotesForIssue operation.

Sample request for getVotesForIssue
{
    "username":"admin",
    "password":"jira@jaffna",       
    "uri":"https://testcon.atlassian.net",        
    "issueIdOrKey":"TEST-1"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e1143

Creating many issues in one bulk operation 

This operation creates many issues in one bulk operation.

createBulkIssue
<jira.createBulkIssue>
	<issueUpdates>{$ctx:issueUpdates}</issueUpdates>
</jira.createBulkIssue>
Properties
  • issueUpdates : The array of objects containing the issue details.
Sample request

Following is a sample REST/JSON request that can be handled by the createBulkIssue operation.

Sample request for createBulkIssue
{
	"uri": "https://connector.atlassian.net",
	"username": "admin",
	"password": "1qaz2wsx@",
	"issueUpdates": [
		{
			"update": {},
			"fields": {
				"project": {
					"id": "10001"
				},
				"summary": "something's very wrong",
				"issuetype": {
					"id": "10002"
				}
			}
		}
	]
}
Related JIRA API

 

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e1295

Assigning an issue to a user 

This operation assigns an issue to a user.

assignIssueToUser
<jira.assignIssueToUser>
    <name>{$ctx:name}</name>
	<issueIdOrKey>{$ctx:issueIdOrKey}</issueIdOrKey>
</jira.assignIssueToUser>
Properties
  • name : The name of the assignee.
  • issueIdOrKey : A String containing an issue key.
Sample request

Following is a sample REST/JSON request that can be handled by the assignIssueToUser operation.

Sample request for assignIssueToUser
{
	"uri": "https://connector.atlassian.net",
	"username": "admin",
	"password": "1qaz2wsx@",
	"name": "vrajenthiran",
	"issueIdOrKey": "WSO2CON-4"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e928 

Retrieving all comments for an issue 

This operation retrieves all comments for an issue.

getCommentById
<jira.getCommentById>
    <commentId>{$ctx:commentId}</commentId>
    <expand>{$ctx:expand}</expand>
	<issueIdOrKey>{$ctx:issueIdOrKey}</issueIdOrKey>
</jira.getCommentById>
Properties
  • commentId : The unique identifier of the comment.
  • expand : The optional flags: renderedBody (provides body rendered in HTML).
  • issueIdOrKey : A string containing the issue ID or key the comment belongs to.
Sample request

Following is a sample REST/JSON request that can be handled by the getCommentById operation.

Sample request for getCommentById
{
	"uri": "https://connector.atlassian.net",
	"username": "admin",
	"password": "1qaz2wsx@",
	"commentId" : "10001",
	"issueIdOrKey":"TESTPM1-3"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e1014 

Sending a notification to the list or recipients 

This operation sends a notification (e-mail) to the list or recipients defined in the request.

sendNotification
<jira.sendNotification>
    <subject>{$ctx:subject}</subject>
    <issueIdOrKey>{$ctx:issueIdOrKey}</issueIdOrKey>
    <textBody>{$ctx:textBody}</textBody>
    <htmlBody>{$ctx:htmlBody}</htmlBody>
    <toReporter>{$ctx:toReporter}</toReporter>
    <toAssignee>{$ctx:toAssignee}</toAssignee>
    <toWatchers>{$ctx:toWatchers}</toWatchers>
    <toVoters>{$ctx:toVoters}</toVoters>
    <toUsers>{$ctx:toUsers}</toUsers>
    <toGroups>{$ctx:toGroups}</toGroups>
    <restrictGroups>{$ctx:restrictGroups}</restrictGroups>
	<restrictPermissions>{$ctx:restrictPermissions}</restrictPermissions>
</jira.sendNotification>
Properties
  • subject: The subject of the notification.
  • issueIdOrKey: A string containing the issue ID or key the comment will be added to.
  • textBody: The text body of the notification.
  • htmlBody: The HTML body of the notification.
  • toReporter: The boolean flag to indicate whether to notify the reporter.
  • toAssignee: The boolean flag to indicate whether to notify the assignee.
  • toWatchers: The boolean flag to indicate whether to notify the watchers.
  • toVoters: The boolean flag to indicate whether to notify the voters.
  • toUsers: The boolean flag to indicate whether to notify the users.
  • toGroups: The array of notification groups to be notified.
  • restrictGroups: The Array of notification groups to be restricted.
  • restrictPermissions: The array of restricted permissions for the notification.
Sample request

Following is a sample REST/JSON request that can be handled by the sendNotification operation.

Sample request for sendNotification
{
	"uri": "https://connector.atlassian.net",
	"username": "admin",
	"password": "1qaz2wsx@",
	"issueIdOrKey" : "TESTPM1-3",
	"subject" : "notification subject",
	"textBody":"The text body",
	"htmlBody":"Lorem ipsum <strong>dolor</strong> sit amet, consectetur adipiscing elit. Pellentesque eget",
	"toReporter":"false",
	"toAssignee":"false",
	"toWatchers":"true",
	"toVoters":"true",
	"toUsers":[
            {
                "name": "vrajenthiran",
                "active": false
            }
        ],
	"toGroups":[
            {
                "name": "notification-group",
                "self": "http://www.example.com/jira/rest/api/2/group?groupname=notification-group"
            }
        ],
	"restrictPermissions":[
            {
                "id": "10",
                "key": "BROWSE"
            }
        ], "restrictGroups": [
            {
                "name": "notification-group",
                "self": "http://www.example.com/jira/rest/api/2/group?groupname=notification-group"
            }
        ]
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e902 

Casting your vote in favour of an issue 

This operation casts your vote in favour of an issue.

addVotesForIssue
<jira.addVotesForIssue>
	<issueId>{$ctx:issueId}</issueId>
</jira.addVotesForIssue>
Properties
  • issueId : The ID of the issues that the vote is made for.
Sample request

Following is a sample REST/JSON request that can be handled by the addVotesForIssue operation.

Sample request for addVotesForIssue
{
  "uri": "https://testappmahesh.atlassian.net",
  "username": "testapp.mahesh2",
  "password": "1qaz2wsx@",
  "issueId":"TP-1"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e1133

Retrieving the list of watchers for the issue with the given key 

This operation retrieves the list of watchers for the issue with the given key.

getWatchersForIssue
<jira.getWatchersForIssue>
	<issueId>{$ctx:issueId}</issueId>
</jira.getWatchersForIssue>
Properties
  • issueId : The string containing an issue key.
Sample request

Following is a sample REST/JSON request that can be handled by the getWatchersForIssue operation.

Sample request for getWatchersForIssue
{
	"uri":"https://connector.atlassian.net",
	"username":"admin",
	"password":"1qaz2wsx@",
	"issueId":"TESTPM1-3"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e1232

Removing a user from an issue's watcher list  

This operation removes a user from an issue's watcher list.

removeUserFromWatcherList
<jira.removeUserFromWatcherList>
    <name>{$ctx:name}</name>
	<issueId>{$ctx:issueId}</issueId>
</jira.removeUserFromWatcherList>
Properties
  • name: String containing the name of the user to remove.
  • issueId : String containing an issue key.
Sample request

Following is a sample REST/JSON request that can be handled by the removeUserFromWatcherList operation.

Sample request for removeUserFromWatcherList
{
	"uri":"https://connector.atlassian.net",
	"username":"admin",
	"password":"1qaz2wsx@",
	"issueId":"TESTPM1-3",
	"name" : "rasika"
}
Related JIRA API

https://developer.atlassian.com/static/rest/jira/6.1.html#d2e1274 

Sample Configuration

Following is a sample proxy service that illustrates how to connect to Jira with the init operation and use the addAttachmentToIssueId operation.

addAttachmentToIssueId
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="addAttachmentToIssueId"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <jira.init>
            <username>{$url:username}</username>
            <password>{$url:password}</password>
            <uri>{$url:uri}</uri>
         </jira.init>
         <jira.addAttachmentToIssueId>
            <issueIdOrKey>{$url:issueIdOrKey}</issueIdOrKey>
         </jira.addAttachmentToIssueId>
         <respond/>
      </inSequence>
      <outSequence/>
      <faultSequence/>
   </target>
   <description/>
</proxy>