Update fixVersions in REST API

Darius M April 10, 2017

Dear Community,

 

I would like to update an existing issue. I use following REST Call:

 

curl -u admin:admin -s  -X PUT --data '{"fields":{"fixVersions":[{"version":"1.8.0"}]}}' -H 'Content-Type: application/json' https://jira/rest/api/2/issue/ISSUE-1

 The response is empty. What am I doing wrong?

 

Thanks

Darius

2 answers

0 votes
Sarah Dwyer November 10, 2020

The JSON needs to be like this: 

let JiraClient = require("jira-connector");


let labels = ["label1", "label2", "label3", "label4"];
let jiraIssueLabels = [];
let fixVersionsLabels = [ {"add" : {"name" : "release_TEST"}} ];

labels.forEach(label => jiraIssueLabels.push({"add": label}));

let bodyData = { issueId: `ENG-224`,
issue: {
update: {
labels: jiraIssueLabels,
fixVersions: fixVersionsLabels
}
}
};

jira.issue.editIssue(bodyData);

 

More simply: 

{ 
issueId: `ENG-224`,
issue: {
update: {
fixVersions:  [ {"add" : {"name" : "release_TEST"}} ]
}
}
}

 

Note: the fixVersions value (ex: release_TEST) must already exist in Jira to work  

0 votes
Jobin Kuruvilla [Adaptavist]
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.
April 10, 2017

Try this:

curl -D- -u admin:admin -X PUT --data '{"update":{"fixVersions":[{"set": [ {"name":"1.8.0"} ] }]}}' -H "Content-Type: application/json" https://jira/rest/api/2/issue/ISSUE-1
Darius M April 10, 2017

I am sorry, but this call is not working. 

 

{"errorMessages":["Can not deserialize instance of java.util.ArrayList out of START_OBJECT token\\n at [Source: org.apache.catalina.connector.CoyoteInputStream@3956ce; line: 1, column: 12] (through reference chain: com.atlassian.jira.rest.v2.issue.IssueUpdateBean[\\"update\\"])"]}
Jobin Kuruvilla [Adaptavist]
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.
April 12, 2017

Hmm, what is your JIRA version?

Darius M April 13, 2017

7.3.3

Rudhuwan Abu Bakar January 28, 2019

This works for me. However, it overwrote the existing values. What option to use for appending the new value instead?

Suggest an answer

Log in or Sign up to answer