Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira API Create a task that has a parent

Tariq Saeed September 10, 2019

Is there a way to create an issue with type 10100 "Task" with a parent issue of a type 10001 "story" using Jira api, because whenever i try this it responses that the issue id 10100 cannot have a parent, despite that I used to do so using Jira GUI.

 

I am using Postman to test that out, below is the json object i am sending

{
"update": {},

"fields": {
"project": {
"id": "15100"
},
"parent": {
"key": "TFL-128"
},
"issuetype": {
"id": "10100"
},

"summary": "some task",
"components": [],

"description": "some desc"

}
}

 

So any ideas?

3 answers

0 votes
LarryBrock
Community Champion
September 11, 2019

Hi @Tariq Saeed 

Just wanted to confirm "Task" is a sub-issue type.  If it's not, that's the reason you can't create it with a parent.  Cheers!

Tariq Saeed September 11, 2019

I am using the type id "10100" to appear on Jira as a task, but the API responses that this id should not have a parent.

I figured out recently that I might be able to do that using the link issue creation feature, but this has to be done separately in a second step after creating the task and receiving its id/key. I was hoping that I can do this in one request.

0 votes
Mohamed Benziane
Community Champion
September 11, 2019

I find this code can you try it :

 

{
"fields":
{
"project":
{
"key": "TEST"
},
"parent":
{
"key": "TEST-1"
},
"summary": "Sub-task of TEST-1",
"description": "Don't forget to do this too.",
"issuetype":
{
"id": "5"
}
}
}

 

This code is coming from the jira documentation

Hope this helps

0 votes
Mohamed Benziane
Community Champion
September 10, 2019

Hi @Tariq Saeed 

 

I don't know wich langage you use but in python this work fine

 issue_dict={
'project':{'key':'projectkey'},
'summary': 'test',
'description': 'test',
'issuetype': {'name':'issue type you want to create'},
'parent': {'key':'key of your task'},

}
Tariq Saeed September 10, 2019

I use nodejs, will try ur code out and let u know what happened, thank u

Tariq Saeed September 10, 2019

I got this response 

"errors": { "issuetype": "issue type is required" }

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events