{{announcement.body}}
{{announcement.title}}

Mule Rest Connector, a Simplified Option to Integrate JIRA

DZone 's Guide to

Mule Rest Connector, a Simplified Option to Integrate JIRA

We will discuss to use Mule for such integration to seamless data flow issue without manual login to JIRA.

· Integration Zone ·
Free Resource

JIRA and Mulesoft are one of the leading products in their own space. As per the Gartner report, they are placed in the Magic quadrant. This makes sense to introduce process or demonstrate some steps, which help to automate processes or integration with other systems.

Anypoint product suite from Mulesoft is a popular ESB and having a rich list of connector/adapter to integrate the different system, hosted in an on-premise server or a cloud setup. 

We will be taking on of such a product majorly issue for project management cum issue tracking. Atlassian JIRA is one of the leading products for Agile practitioners. Since the IT ecosystem is settling with a lot of the previous set of products like HP Service manager, BMC remedy, or a simple tool like MS excel. Many Agile practitioners prefer to use such a product.

 We will discuss using Mule for such integration to seamless data flow issues without manual login to JIRA.

 There are two ways to connect Atlassian JIRA through Mule.

  1. Available Connector
  2. REST API

You can read and download the JIRA connector in Mule exchanges. There is a maven dependency snippet that is also available in exchange to use for maven-based projects.

 https://www.mulesoft.com/exchange/org.mule.modules/jirarest-connector/

The connector is built and supported by a mule partner, any license details are handled by the provider. It is not available in the studio by default. You need to download it from the exchange.

mule jira

You will able to search without login in exchange but you must login to download. 

mulesoft assets

Maven Dependency (use this snippet if using maven based project)

Java
 




x


1
<dependency>
2
   <groupId>org.mule.modules</groupId>
3
   <artifactId>jirarest-connector</artifactId>
4
   <version>1.3.0</version>
5
</dependency>



You can see this screen through Anypoint studio. Click Install button to get installed in anypoint studio and respond to the following screen like accepting terms and conditions etc. It will prompt to restart studio once installed successfully.

anypoint

install items

license test

You will able to find the JIRA component in pallet now. Revisit your installation if it's still not appearing.
jira crud demo

Using JIRA Rest Connector with Anypoint Studio 6.x

You can use the JIRA connector to connect with the Jira server and work on Jira related work. This will simplify integration with JIRA. You need to specify the host, port, and credentials for connector configuration. For Endpoint, you need to specify path and method.

Place the HTTP Listener to the source in the flow to receive the input message.
jira connection

Now you can place the JIRA Rest Connector component to Message Processor inflow and configure it. Click Add Connector Configuration for Basic Authentication and it will open another window.

Provide the Jira server URL, username and password, click “Test Connection”. 

Click Ok once the connection is tested successfully. The password is deprecated for cloud setup, user API token in place for a password.

jira rest

Now you can place the JIRA Connector component is ready to use. A list of supported operations will be listed in operation drop-down.

jira connection

We will use “create Issue” as an operation for our example. Since it needs to follow a specific message format, a transforming message will help to map the required input format.

Transferring Message

A transformation message is required if the message passed and expected by JIRA is the same. Since this case, to create a message, there is a requirement of a specific message structure, Transform message is the right fit in this type of scenario.

message flow

Sample transformation snippet.

Java
 




x


 
1
fields: {
2
issuetype: {
3
id: payload.issueType
4
},
5
project: {
6
key: payload.projectKey
7
},
8
priority: {
9
id: payload.issuePriority
10
},
11
description: payload.description,
12
summary: payload.summary
13
}



Testing the Application

You can use Postman to test the application. First, deploy the application with Anypoint Studio, and run the application.

We will send a message to the Mule application using the HTTP POST method. The test URL is http://localhost:8081/issues.

HTTP post

Let validate in JIRA if we can find a task.

open issues in jira

We will access newly created issue directly through JIRA rest API and validate if created Jira is accessible.

Request GET on http://localhost:8080/rest/api/2/issue/TES-51

localhost

Summary

We learn from this article

1. Where to get JIRA Rest Connector?

2. JIRA Rest Connector documentation.

3. How to download and configure in Anypoint Studio?

4. What is the requirement to go through Basic Authentication path?

5. How to use connector as message processor in flow?

6. Created and read JIRA ticket using Postman.

7. Verified in Jira console to ensure, Task is created according to input data.

Topics:
integration, jira, mule, mule 3.9, mulesoft

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}