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
Accepted answer
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]

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

809 views 3 9
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