Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Unable to update custom field in jira using REST API

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}"$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?


1 answer

0 votes
Warren Community Leader Mar 08, 2021

Hi @Sach 

Two things to try :

  1. Have you tried within Jira using the UI that you're able to change that customfield away from it's default to the other value?
  2. If 1. above works, then try using the API to only update an existing issue and change the customfield's value from the default to the other value. If that also works, you may need to consider doing it in 2 steps - create the issue with one API call then use another API call to change the customfield

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.

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

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

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"

{"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"

{"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

Suggest an answer

Log in or Sign up to answer

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