Set issue priority and component with REST API

Guillaume Polet February 7, 2012

I was wondering how to set the priority and the component fields of an issue when creating it through the REST API.

If put this:

{
"fields": {
"project": {
"id": "10000"
},
"summary": "'te'te",
"description": "e'reserg",
"issuetype": {
"id": "1"
}
}
}

everything goes fine. If I put this:

{
"fields": {
"project": {
"id": "10000"
},
"summary": "'te'te",
"description": "e'reserg",
"issuetype": {
"id": "1"
},
"priority": {
"id": "1"
},
"component": {
"id": "10000"
}
}
}

I get a 400 response (Bad request). I don't understand what is wrong.

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Guillaume Polet February 7, 2012

Ok, I found the issue. Actually, the component is an array and logically the attribute name is plural (components). So to fix this, it should rather be:

{
"fields": {
"project": {
"id": "10000"
},
"summary": "'te'te",
"description": "e'reserg",
"issuetype": {
"id": "1"
},
"priority": {
"id": "1"
},
"components": [{
"id": "10000"
}]
}
}

Marx Bievor September 6, 2018

how do I find out about the component id?

0 votes
Ashish Jain June 24, 2015

Dear Guillaume Polet,

what URL you used to set values in Component ?

is it PUT or POST and please let me know url also for an issue.

TAGS
AUG Leaders

Atlassian Community Events