Forums

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

Creating Sub-Task In Jira via API Rest

James Lewis April 16, 2018

Hi,

 

Ive been following the api rest instructions to create a sub-task. I have it creating tasks no problem, but sub tasks - it keeps giving me the following error

 

400 Bad Request

{
"errorMessages": [],
"errors": {
"project": "project is required"
}
}

 

 

Im using this:

{"fields":
{"parent":{"id":"10013"},
"project":{"id":"TMEQ-12"},
"summary":"a test sub-task of my first issue",
"issuetype":{"id":"5"},
"description":"description"}
}

 

Can anyone assist, Please?

James

 

 

1 answer

1 accepted

3 votes
Answer accepted
Tarun Sapra
Community Champion
April 16, 2018

You are passing

"project":{"id":"TMEQ-12"},

This doesn't look like a valid project id to me thus the error.

Tarun Sapra
Community Champion
April 16, 2018

See this working sample from docs for sub-task creation using REST API

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

 https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/ 

James Lewis April 16, 2018

Thanks it was the id (5) that was wrong in my case. All working now :-)

Tarun Sapra
Community Champion
April 16, 2018

Glad to know it's working, please accept/upvote answer so that others are helped as well.

Anil Kumar
Contributor
October 14, 2018

@James Lewis | @Tarun Sapra I'm new for jira-rest-api, can you please help with some document guideline. I want to auto create set of sub-task when any story or defect created. Looking for help.

[for now not looking for paid add-on]

Venugopala Naidu
Contributor
February 17, 2019

Hi @Tarun Sapra

Thank you Tarun , it really helped me 

Like Tarun Sapra likes this

Suggest an answer

Log in or Sign up to answer