Trying to update fixVersion field using Jenkins "Jira Issue Results Updater"

michael_velasco April 5, 2017

Hello I am trying to Automate to update the fixVersion field of tickets in Jira using Jenkins "Jira Issue Results Updater. 

 

Ive used the following Parameters:

Jira REST Base URL: https://<IP:port>/jira/rest/api/2

Jira Custom field to be edited: fixVersion

Jira Custom field value: <value>

 

Bu the I am getting the error below:

Unable to connect to REST service to set field
java.io.IOException: Server returned HTTP response code: 400 for URL

 

Also, I've tried a workaround by running a curl command which is:

Command: 

curl -D- -u <username>:<password> -X PUT -d "{\"update\":{\"fixVersions\":[{\"set\":[{\"id\":\"<value>\"}]}]}}" -H "Content-Type: application/json" "https://<IP:Port>/jira/rest/api/2/issue/<issue-key>"

But I got the below:

HTTP/1.1 400 Bad Request

{"errorMessages":[],"errors":{"fixVersions":"Version id '<value>' is not valid"}}

 

Thanks in advance.

1 answer

0 votes
David Chan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 13, 2017

I used your curl command and it worked just fine. It only broke with a 400 Bad Request when I used an invalid version ID value.

Maybe you're using the version name instead of ID. The ID value is the ID value stored in the database and not the version name.

An alternative to using the ID is using the NAME.

 

Example:

Using version's id:

curl -D- -u admin:pw -X PUT -d "{\"update\":{\"fixVersions\":[{\"set\":[{\"id\":\"10100\"}]}]}}" -H "Content-Type: application/json" "http://localhost:8080/rest/api/2/issue/SSP-22"

Using version's name:

curl -D- -u admin:pw -X PUT -d "{\"update\":{\"fixVersions\":[{\"set\":[{\"name\":\"v1\"}]}]}}" -H "Content-Type: application/json" "http://localhost:8080/rest/api/2/issue/SSP-22"

Suggest an answer

Log in or Sign up to answer