Jira api, add new fix version does not work

VLDL November 24, 2017

Hi all,

I try to add a fix version(new version which is not exist yet) to jira issue.

$json = '{ "update" : {"fixVersions" : [ {"add" : {"name" : "TEST-123"}}] } }'

Invoke-RestMethod -Uri https://jira.xxx.lan/rest/api/2/issue/ISSUE-911 -Method PUT -Headers $headers -ContentType "application/json" -Body $json

It works if the version "TEST-123" is already exist. But if it is not, I am getting 400 error (bad request).

Could you help, please?

1 answer

0 votes
Alexey Matveev
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.
November 24, 2017

Hello, 

Check first if the version exists with GET /rest/api/2/project/{projectIdOrKey}/versions

If not, then create it with POST /rest/api/2/version

Then use your Rest call

VLDL November 24, 2017

Thank you very much, Alexey! I will try. 

Suggest an answer

Log in or Sign up to answer