I have a jira custom field that I got created by the admins. It is a dropdown with 2 possible field values. One of them is set as a default.
In my shell script from where the data is created, I am trying to update the same custom field to the value which is not the default (if certain conditions are met). After the condition is met, and I am getting the correct value for $customfield1(the other non-default value) and $key(issue number)
I am firing this
curl --silent -D- -u charlie:charlie -X PUT --data {"fields" : {"customfield1": $customfield1}} -H "Content-Type: application/json" -w "\n%{http_code}"https://jira.company.com/rest/api/2/issue/$key
However, no matter what I try, my issue is getting created with the default value of the customfield1. I am not able to override with my other value via this command. Any thoughts?
Hi @[deleted]
Two things to try :
Hi @Warren
Thank you for responding. 1 works if I just open the ticket and update it manually.
Let me try the second point you listed above.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Via the linux command line, I tried the below 4 methods to update the existing Jira issue each of which gave me the following errors :
Command 1:
curl -D- -u charlie:charlie -X PUT --data {"update" : {"customfield_38101": [{"set" : "ABC"}]}} -H "Content-Type: application/json" -w https://jira.company.com/rest/api/2/issue/COMP-1022
curl: (6) Couldn't resolve host ':'
curl: (3) [globbing] unmatched brace at pos 20
curl: (3) [globbing] illegal character in range specification at pos 2
curl: (6) Couldn't resolve host ':'
-----------------
Command 2:
curl -D- -u charlie:charlie -X PUT --data {"fields": {"customfield_38101": {"value":"ABC"}}} -H "Content-Type: application/json" -w https://jira.company.com/rest/api/2/issue/COMP-1022
curl: (3) [globbing] unmatched brace at pos 20
curl: (6) Couldn't resolve host 'value:ABC'
--------------------------------
Command 3:
curl -D- -u charlie:charlie -X PUT --data "{\"fields\" : {\"customfield_38101\": [{ \"value\": \"ABC\" }]}}" -H "Content-Type: application/json" https://jira.company.com/rest/api/2/issue/COMP-1022
{"errorMessages":[],"errors":{"customfield_38101":"Could not find valid 'id' or 'value' in the Parent Option object."}}
--------------------
Command 4:
curl -D- -u charlie:charlie -X PUT --data "{\"fields\" : {\"customfield_38101\": [{ \"value\": \"id\": \"52803\" }]}}" -H "Content-Type: application/json" https://jira.company.com/rest/api/2/issue/COMP-1022
{"errorMessages":["Unexpected character (':' (code 58)): was expecting comma to separate OBJECT entries
Any suggestions to either of the above ? I tried several options from the Atlassian's documentation like using update, fields, set, etc . From the editmeta I was able to identify the custom field number and the value ID I needed but just not able to edit it
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.