How do I read "Issues in Epic" programmatically ?

Hi..

I have JIRA Agile plugin installed in my jira and i want to read "issues in epic" for a given Epic from jira listener.

Is there any API i can use to read "Issues in Epic" from jira listener?

I tried reading like a subtask as follows but it didnt help!

Collection<Issue> subtasks= issue.getSubTaskObjects();

Any help?

Thanks in Advance!!

Ohm

3 answers

I even tried accessing these like issue links. That didnt help either.

Looks like i found one workaround.

These links are stored in jira database as issue links.

select * from issuelinktype gives me

/10500Epic-Story Linkhas Epicis Epic ofjira_gh_epic_story/

so, for the moment I can read it from database table issuelink by querying on linktype.

This can be done on two steps:

1- Rest call

2- Extract issues from the Server Response JSON String

 

1-

public String getIssuesForEpic(long epicID) {

String ServerJSONOutput = NULL_DATA;
try{
Client client = Client.create();
client.addFilter(new HTTPBasicAuthFilter(JIRA_ADMIN_USERNAME, JIRA_ADMIN_PASSWORD));
WebResource webResource = client.resource(JIRA_URL + "/rest/agile/1.0/epic/" + epicID + "/issue");
ClientResponse response = webResource.type("application/json").get(ClientResponse.class);
log.trace("REST Response to getIssuesForEpic() = {}",response.getStatus());
ServerJSONOutput = response.getEntity(String.class);
log.trace("Output from Server .... {}", ServerJSONOutput);
} catch(Exception e){
e.printStackTrace();
}

return ServerJSONOutput;
}

 

 

2-

Use Java JSONObject to go through the issue array and convert them into issue object using IssueManager.getIssueObject(long id)

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Wednesday in Jira

Make your Atlassian Cloud products more secure: our NEW admin security guide

Hey admins! I’m Dave, Principal Product Manager here at Atlassian working on our cloud platform and security products. Cloud security is a moving target. As you adopt more products, employees consta...

247 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you