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

get Parent issue via rest or SOAP API clients

Vasyl Khrystiuk May 28, 2012

Is there way to check - if an issue is a subtask, and if it is - get link(key, id) to parent issue?

In REST API client(jira-rest-java-client-0.6-m2.jar) and in SOAP API client(jira-soap-5.0.0.jar) i didn't find such methods.
Maybe i missed something? How to operate this?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Vasyl Khrystiuk May 28, 2012
Issue iss2 = getRestClient().getIssueClient().getIssue(task.getKey(), new NullProgressMonitor());
        Field ob  = iss2.getField("parent");
        if (ob!=null){
        	JSONObject jsonParent = (JSONObject)ob.getValue();
        	BasicIssue bi = null;
        	try {
        		bi = new BasicIssueJsonParser().parse(jsonParent);
        	} catch (JSONException e1) {
        		e1.printStackTrace();
        	}
        	System.out.println("parrent: Parced key: "+bi.getKey());
        }else{
        	System.out.println("parrent: no parent found");
        }

Lee Correll
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 30, 2012

I'm not sure what you're using to retrieve data, but if I use a CURL request via PowerShell:

$Array = .\curl.exe https://host.jira.com/rest/api/latest/issue/[Issuekey]

Convert the response from JSON

then examine $Array.fields.issuetype.subtask and look for a TRUE value...and it's a subtask.

$Array.fields.parent.key holds the parent issue.

Like rcoenen likes this
M A August 7, 2012

msangel, thanks for the answer! it seems u use the REST. But can u please provide the way to get parent issue via soap api? thanks in advance

TAGS
AUG Leaders

Atlassian Community Events