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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,003 views 12 18
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot