How do I read "Issues in Epic" programmatically ?

ohmkaar kambhampati
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 1, 2014

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

0 votes
Yassin September 19, 2017

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)

0 votes
ohmkaar kambhampati
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 1, 2014

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.

0 votes
ohmkaar kambhampati
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 1, 2014

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

Suggest an answer

Log in or Sign up to answer