It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Creating Sub-Task In Jira via API Rest

James Lewis Apr 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

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

James Lewis Apr 16, 2018

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

Tarun Sapra Community Leader Apr 16, 2018

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

Anil Kumar2 Oct 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]

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
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Next-gen

Introducing subtasks for breaking down work in next-gen projects

Teams break work down in order to help simplify complex tasks. This is often done iteratively, with tasks being broken down into smaller tasks and so on until the work is accurately captured in well-...

2,137 views 14 17
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you