Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to add Fix version

akmalick
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 4, 2022
I am trying to add Fix Version to an issue via a curl request. That particular jira Issue page does have "Fix Version/s:" field. Also the create Issue screen contains the field "Fix Version/s:". But somehow it is not letting me to add the fix version.
Honestly speaking the Jira Rest API is not that user-friendly. Its pretty tough to understand what the API needs. I might be wrong, in which case I seek your guidance.

Additionally if you could guide me how to achieve this same result using Jira Rest Java Client.


As per the documentation, The general structure of an update is field, array of verb-value pairs. For example:

{ "update": {

    "field1": [ {"verb": value}, {"verb": value}, ...],

    "field2": [ {"verb": value}, {"verb": value}, ...],

}}

If I go by the above explanation then for my case of updating fixVersion the structure would look sth like :

{ "update": {

    "fixVersions": [ {"add": "AB 2022.02.000"}]

}}

So as per above format my request should be :

curl -D- -u ${ADMIN_USER}:${ADMIN_PASSWORD} -X PUT --data "{\"update\" : { \"fixVersions\" : [{\"add\":\"AB 2022.02.00\"}]}}" -H "Content-Type: application/json" https://jira2.company.com/rest/api/2/issue/ProjCode-12345

If I execute above command I get below response :

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

I looked for similar issues online and came across a couple of Atlassian community threads, but they didn't seem to help my cause.

Below are the different curl requests (along-with their response) that I have tried executing based on the suggestions that I came across :

Request #1 :

curl -D- -u ${ADMIN_USER}:${ADMIN_PASSWORD} -X PUT --data "{\"update\" : { \"fixVersions\" : {\"add\":{\"name\":\"AB 2022.02.000\"}}}}" -H "Content-Type: application/json" https://jira2.company.com/rest/api/2/issue/ProjCode-12345

Response #1 :

{"errorMessages":["Can not deserialize instance of java.util.ArrayList out of START_OBJECT token\n at [Source: org.apache.catalina.connector.CoyoteInputStream@29848f08; line: 1, column: 15] (through reference chain: com.atlassian.jira.rest.v2.issue.IssueUpdateBean[\"update\"])"]}


Request #2 :

curl -D- -u ${ADMIN_USER}:${ADMIN_PASSWORD} -X PUT --data "{\"update\" : { \"fixVersions\" : {\"add\":[{\"name\":\"AB 2022.02.000\"}]}}}" -H "Content-Type: application/json" https://jira2.company.com/rest/api/2/issue/ProjCode-12345

Response #2 :

{"errorMessages":["Can not deserialize instance of java.util.ArrayList out of START_OBJECT token\n at [Source: org.apache.catalina.connector.CoyoteInputStream@14c3752f; line: 1, column: 15] (through reference chain: com.atlassian.jira.rest.v2.issue.IssueUpdateBean[\"update\"])"]}

Request #3 :

curl -D- -u ${ADMIN_USER}:${ADMIN_PASSWORD} -X PUT --data "{\"update\" : { \"fixVersions\" : [{\"add\":[{\"name\":\"AB 2022.02.000\"}]}]}}" -H "Content-Type: application/json" https://jira2.company.com/rest/api/2/issue/ProjCode-12345

Response #3 :

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


Request #4 :

curl -D- -u ${ADMIN_USER}:${ADMIN_PASSWORD} -X PUT --data "{\"update\" : { \"fixVersions\" : [{\"add\":{\"name\":\"AB 2022.02.000\"}}]}}" -H "Content-Type: application/json" https://jira2.company.com/rest/api/2/issue/ProjCode-12345

Response #4 :

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
















1 answer

1 vote
Michael Hedman September 30, 2022

first, I would check to see if you can see the field on the issue page as an available field.  I have one issue type that doesn't have fixVersions assigned to it, and another that does.  

 

I was getting the same error which led me here.  

 

My final curl command that worked was something like this:

 


curl --request PUT \

--url 'https://YOURURL.atlassian.net/rest/api/3/issue/ISSUE_ID' \

--user 'USER:APIKEY' \

--header 'Accept: application/json' \

--header 'Content-Type: application/json' \

--data '{

"update": {

"fixVersions": [

{

"add": {"name":"Test Version"}

}

]

}

}'
Michael January 28, 2025

This is the answer.

Eric McDonald
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 19, 2025

I was able to adapt this for python to use:

jira.update_issue(issue_key, {'update': {'fixVersions': [{'add': {'name': 'v1.0'}}]}})

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.13.13
TAGS
AUG Leaders

Atlassian Community Events