The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

How to write a REST API program to create a Multiple Sub-tasks for an Issue?

Siva Anantha Satyanarayana Singamsetti
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 7, 2019

Can we use " for loop" in REST API program, to get Multiple Sub-tasks for an Issue ?

Below code i have used for this

REST API code:

 

{
"fields":
{
"project":
{
"key": "TEST"
},
"parent":
{
"key": "TEST-10"
},
for ( int i=1; i <=3; i++)
     {
       "summary": "Subtask-TEST10",
       "description": "Subtask of TEST-10",
       "issuetype":
           {
             "id": "10601"
           }
     }
}
}

 

For executing I used curl command:

curl -D- -u admin:admin -X POST --data "@MutlipleSubtask.txt" -H "Content-Type: application/json" http://localhost:8081/rest/api/2/issue/

 

Could someone help me with it?

And also is there any other way to do it in RESTAPI?

Thanks in Advance

 

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Leo
Community Champion
November 8, 2019

Hi @Siva Anantha Satyanarayana Singamsetti ,

you may need to go with following rest api endpoint POST  /rest/api/2/issue/bulk

Refer this page for more details: https://docs.atlassian.com/software/jira/docs/api/REST/7.12.0/?&_ga=2.142165051.860651512.1572849788-2006055560.1571762377#api/2/issue-createIssues

 

BR,

Leo

Siva Anantha Satyanarayana Singamsetti
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 10, 2019

Thanks Leo,  it worked.

Its a very good useful Link