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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Update fixVersions in REST API

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

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

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\\"])"]}

Hmm, what is your JIRA version?

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

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  

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you