Forums

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

Create Story with Sub-Tasks via API

Dan Bower December 21, 2021

I'm scheduling creation of Issues with Sub-Tasks. I plan to do this via API, and have created the JSON file for creating a Story. No problem.

What I'm trying to do now is create a number of Sub-Tasks for that newly created issue. My understanding is that this can't all be done via a single action. If I want to bulk create 5 Sub-Tasks for the story, would I have to do a GET request to return the latest issue created in my project and then insert that via variable into the next POST for creating the Sub-Tasks? All the examples I've found for Sub-Task creation have hard-coded issuekeys in them. 

1 answer

0 votes
Sunny Ape
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 21, 2021

Hello @Dan Bower 

Are you asking a question, or just stating the exact method of how Sub-tasks are created?

PS. There is no need to do a GET after the parent Story is created. When you do the POST to create that Story, its ID is returned in the JSON response, so just parse that bit of data out of the response, then use it in the subsequent POST requests to create the child Sub-tasks.

Dan Bower December 21, 2021

Question is how do I parse and pass that value? Or does that depend. I'm trying to do this using the Ansible uri module, but am open to alternatives.

Sunny Ape
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 21, 2021

Yes, it depends totally on the language / toolset you are using, what form it receives the JSON response and how to manipulate that object and get specific bits of data from it.

I don't use Ansible, so can't help any further, but I'm sure a quick Google search on the topic will yield lots of examples and methods.

Suggest an answer

Log in or Sign up to answer