Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Rest API develpoment in eventlistener

Onkar Ahire
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 15, 2013

Hi All,

I am writing jira event listener in 6.0 and in issueUpdated event I want to connect to another JIRA instance using REST API or (JRJC),

Please let me know starting from scratch (POM.xml dependency to connect JRJC) because many ways I tried and none of them working at runtime (Exception, null pointer exception, failed to load plugin etc...).

Thanks in advance

Regards

Onkar Ahire

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 15, 2013

There's two parts to this - the plugin structure and the data connection

First, https://developer.atlassian.com/display/JIRADEV/JIRA+Plugin+Guide is a very good start for writing the listener. If you follow the guides here, you should be able to create a listener that catches the events you need and then puts a simple "hello world, here's the data on the issue that's just changed" message out.

Once you've got that, then you can think about the steps you need to create REST calls from that data. Just because you are making the calls to one Jira from another Jira, doesn't mean you need to do anything different. The target Jira has a REST interface for you to use (see https://developer.atlassian.com/display/JIRADEV/JIRA+REST+APIs ) and it really doesn't care that the system making the calls happens to be another Jira.

Onkar Ahire
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 18, 2013

Hi Nic,

I have already familier with JIRA development you refering in first steps,

I am getting AsynchronousJiraRestClientFactory class not found exception at issueUpdated event, I tried to add many dependencies related to JRJC succeed compile time at IDE(Eclipse) but fails at runtime, I am using JIRA 6.0

Please let me know where I goes wrong, Is it the right path currently am I?

Here is java code.

public void issueUpdated(IssueEvent event) 
	{
		super.issueUpdated(event);
		try
		{
			final AsynchronousJiraRestClientFactory factory = new AsynchronousJiraRestClientFactory();
			URI jiraServerUri = URI.create("http://localhost:8088/jira");
			BasicHttpAuthenticationHandler b_auth = new BasicHttpAuthenticationHandler("admin","admin");
			final JiraRestClient restClient = factory.create(jiraServerUri, b_auth);
			Issue issue=restClient.getIssueClient().getIssue("ATN-7").claim();
			System.out.println(issue.getSummary());
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
	}

pom.xml dependency for JRJC

<dependency>
		  <groupId>com.atlassian.jira</groupId>
		  <artifactId>jira-rest-java-client-core</artifactId>
		  <version>2.0.0-m19</version>
	</dependency>

TAGS
AUG Leaders

Atlassian Community Events