Creating Sub-Task In Jira via API Rest

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

1 vote
Answer accepted
Tarun Sapra Community Champion Apr 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 Apr 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/ 

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

Tarun Sapra Community Champion Apr 16, 2018

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

@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]

Hi @Tarun Sapra

Thank you Tarun , it really helped me 

Like 1 person likes this

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 14, 2019 in Jira

Updates to jira.atlassian.com give you visibility into what's coming in Jira Server and Data Center

Hello, Community! My name is Gosia and I'm a Product Manager on Jira Server and Data Center here at Atlassian. Since 2002 when we launched our public issue tracker, jira.atlass...

631 views 1 15
Read article

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