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

How can I Link Jira issues to an epic using java and REST

sajeev May 11, 2015

I could create Jira issues through the Java and REST service by following this Link. Now I want to link the Jira issues(like Tasks) to the already created epic in the project. How can I do this through java code. I have my epic ID(say SALES-1). 

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Volodymyr Krupach
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.
May 12, 2015

Hi sajeev!

Under your link is some basic "home made" JIRA REST client. If you intent to stay with it, you need to extend it with a method that wraps JIRA REST /rest/api/2/issueLink call: https://docs.atlassian.com/jira/REST/latest/#d2e2783

Or you can use implementation from Atlassian: https://marketplace.atlassian.com/plugins/com.atlassian.jira.jira-rest-java-client

The code snippet for REST Java Client for JIRA:

issueRestClient.linkIssue(linkIssueInput);

and javadoc for linkIssueInput:

 https://docs.atlassian.com/jira-rest-java-client-api/2.0.0-m31/jira-rest-java-client-api/apidocs/

sajeev May 28, 2015

Thank you for rerouting. I tried the tutorial code here(https://ecosystem.atlassian.net/wiki/display/JRJC/Tutorial) and solved all the dependencies(https://ecosystem.atlassian.net/wiki/display/JRJC/Project+Dependencies). But I am getting the Exception as follows ======== May 28, 2015 7:05:46 PM com.sun.jersey.api.client.ClientResponse getEntity SEVERE: A message body reader for Java class org.codehaus.jettison.json.JSONObject, and Java type class org.codehaus.jettison.json.JSONObject, and MIME media type application/json; charset=UTF-8 was not found May 28, 2015 7:05:46 PM com.sun.jersey.api.client.ClientResponse getEntity SEVERE: The registered message body readers compatible with the MIME media type are: */* -> com.sun.jersey.core.impl.provider.entity.FormProvider com.sun.jersey.core.impl.provider.entity.StringProvider com.sun.jersey.core.impl.provider.entity.ByteArrayProvider com.sun.jersey.core.impl.provider.entity.FileProvider com.sun.jersey.core.impl.provider.entity.InputStreamProvider com.sun.jersey.core.impl.provider.entity.DataSourceProvider com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General com.sun.jersey.core.impl.provider.entity.ReaderProvider com.sun.jersey.core.impl.provider.entity.DocumentProvider com.sun.jersey.core.impl.provider.entity.SourceProvider$StreamSourceReader com.sun.jersey.core.impl.provider.entity.SourceProvider$SAXSourceReader com.sun.jersey.core.impl.provider.entity.SourceProvider$DOMSourceReader com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General com.sun.jersey.core.impl.provider.entity.XMLRootObjectProvider$General com.sun.jersey.core.impl.provider.entity.EntityHolderReader Exception in thread "main" com.atlassian.jira.rest.client.RestClientException: com.sun.jersey.api.client.ClientHandlerException: A message body reader for Java class org.codehaus.jettison.json.JSONObject, and Java type class org.codehaus.jettison.json.JSONObject, and MIME media type application/json; charset=UTF-8 was not found at com.atlassian.jira.rest.client.internal.jersey.AbstractJerseyRestClient.invoke(AbstractJerseyRestClient.java:75) at com.atlassian.jira.rest.client.internal.jersey.AbstractJerseyRestClient.getAndParse(AbstractJerseyRestClient.java:80) at com.atlassian.jira.rest.client.internal.jersey.JerseyIssueRestClient.getIssue(JerseyIssueRestClient.java:108) at JiraClient.main(JiraClient.java:32) Caused by: com.sun.jersey.api.client.ClientHandlerException: A message body reader for Java class org.codehaus.jettison.json.JSONObject, and Java type class org.codehaus.jettison.json.JSONObject, and MIME media type application/json; charset=UTF-8 was not found at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:549) at com.sun.jersey.api.client.ClientResponse.getEntity(ClientResponse.java:506) at com.sun.jersey.api.client.WebResource.handle(WebResource.java:674) at com.sun.jersey.api.client.WebResource.get(WebResource.java:191) at com.atlassian.jira.rest.client.internal.jersey.AbstractJerseyRestClient$1.call(AbstractJerseyRestClient.java:84) at com.atlassian.jira.rest.client.internal.jersey.AbstractJerseyRestClient.invoke(AbstractJerseyRestClient.java:54) ... 3 more ========= I am trying the Jira client as the java project in eclipse[Just created as New Java Project in Eclipse]. I am not aware of the maven and all. Am I missing any other jar dependency? Or anything should I add to my java project.

TAGS
AUG Leaders

Atlassian Community Events