Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to set components in Jira REST API 5.x while creating a issue?

Mani Chellamuthu July 29, 2012

HI,

I am creating issues using Jira REST API 5.x. Both issue type and components are avaialbe on the same project. The REST API call creates the issue with no component. I tried following syntax, none of them working,

"components": [{"add":{"name":"TestComponent2"}}]
"components": [{"set":{"name":"TestComponent2"}}]
"components": [{"add":[{"name":"TestComponent2"}]}]
"components": [{"set":[{"name":"TestComponent2"}]}]

Please guide me to resolve it.

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Answer accepted
Mani Chellamuthu July 30, 2012

It does not need "add" or "set" to include a component in an issue as per documentation,

This syntax works for me,

"components": [{"name":"TestComponent1"}]

Shradha Singh February 25, 2016

I was also having the same problem but it worked for me. Thanks !!

vikaspwr March 16, 2017

This works perfectly fine for me. "components": [{"name":"TestComponent1"}]

Like Mark Goodrich likes this
Behzad Abdollahi November 16, 2017

how can you add multiple components? I tried followings:

"components": [{"id":"XXXX"},{"id":"YYYY}]

"components": [{"id":"XXXX", "id":"YYYY}]

David Mills October 25, 2018

I would guess you need

"components": [{"name":"XXXX"},{"name":"YYYY}]
Like Mark Goodrich likes this
1 vote
Behzad Abdollahi November 16, 2017

how can you add multiple components? I tried followings:

 

"components": [{"id":"XXXX"},{"id":"YYYY}]

"components": [{"id":"XXXX", "id":"YYYY}]

0 votes
Dan Iancu March 19, 2019

Jira 7.11 :

 

{
"update" : {
"components" : [{"set" : [{"name" : "Automation"}]}]
}
}

 

Yes the json format is hard to follow with so many brackets

TAGS
AUG Leaders

Atlassian Community Events