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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,456,998
Community Members
 
Community Events
176
Community Groups

how to update status in defect using jira rest api

Hi Team,

I am having requirement to automate Defect Status update.

we are using below Rest API in order to update defect status.

 http://localhost:8080/rest/api/2/issue/{defectid}/

using PUT method

Payload :

 {
"expand": "renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations",
"fields": {
"issuetype": {
"description": "A problem which impairs or prevents the functions of the product.",
"name": "Bug",
"subtask": false
},
"description": "laksh12 defect updated",
"project": {
"id": "31266",
"key": "COOKIE",
"name": "COOKIE"
},
"summary": "updated12 defect summary",
"priority": {
"name": "High",
"id": "2"
},
"status":"3"
}
}

Response:

i am getting below error,

{
"errorMessages": [],
"errors": {
"status": "Field 'status' cannot be set. It is not on the appropriate screen, or unknown."
}
}

Kindly do the needful.

Thanks in advance.

1 comment

did u try to change the status number you have choose ? 

It is like the number choosen is wrong

Hi LostIn,

 

Thanks for your reply.

Can you please guide me what is the actual status request need to set.

We are passing the request for failed belongs to 2 and 

passed belongs to 1

actually i am using this request

"status":"3".  

Can you please share what is the valid json payload request for update the defect status.

it's seems that the integer you choose for the status is wrong. I mean, 3 is not a setable status. Can you use an API which can give u number available ? 

 

I mean for exemple, i use a get with this API api/2/issue/issueid/transitions

oRequest.Open("GET", "http://XXXX/rest/api/2/issue/" & id & "/transitions"

to get available transition choice and integer equivalent for those transition.

 

Then i can use a POST with the same API to change my issue transition state.

oRequest.Open("POST", "http://XXXX/rest/api/2/issue/" & id & "/transitions")

and then when i send my data

oRequest.Send(data)

I put this integer in, for example it give this

"expand": "transitions",
"transitions": [

{
"expand": "transitions",
"transitions": [
{
"id": "41",
"name": "Start Prepa",
"to": {
"self": "http://vld-jira:8080/rest/api/2/status/10227",
"description": "",
"iconUrl": "http://vld-jira:8080/images/icons/statuses/generic.png",
"name": "In Preparation",
"id": "10227",
"statusCategory": {
"self": "http://vld-jira:8080/rest/api/2/statuscategory/4",
"id": 4,
"key": "indeterminate",
"colorName": "yellow",
"name": "In Progress"
}}]}

 

Those are for example integer i have to use for issue transition, logically i was using 1,2,3,4 but in fact number are completely illogical.

'41 : Start Prepa
'401 : send mail
'151 : start work
'171 : Cancel
'371 : back to backlog

Thanks LostInMadness Forever for your reply, i am getting below error,

{
"errorMessages": [
"Missing 'transition' identifier"
],
"errors": {}
}

Can you please guide me.

Comment

Log in or Sign up to comment