JIRA API: How do I explicitly set a custom field it's default value?

I have a JIRA board which has a custom field: customfield_20582 which shows up as 'priority', say, in the UI.


It has values 'high', 'medium', 'low' and the default which is 'none'.


I have a request to create a new issue like this:


POST blah/rest/api/2/issue/


        "fields": {
              "key": "ABCD"
           "summary": "here is a summary",
            "customfield_20582": {
                "value": "None",
           "description": "here is a description",
           "assignee": {"name": "123456"},
           "reporter":  {"name": "654321"},
           "issuetype": {
              "name": "my issue type"


Without the 'customfield_20582' bit - this works perfectly, and i get a response with the newly created Issue key.


If I change the 'customfield' bit to 'High', 'Medium' or 'low' it also works fine.


But when I try to set the value to be the default 'None' i get issues:


   "errors": {
        "customfield_20582": "Option id 'null' is not valid"


  "errors": {
        "customfield_20582": "Could not find valid 'id' or 'value' in the Parent Option object."

I've tried:

* "None"

* "Null"

* null

* "-1"

* -1

when I inspect the select element, I see the id is -1 and the value is 'None' - but there must be more to it.

I know if I remove the 'customfield' piece entirely, the default will be used, well, by default - but It would be much easier (because we're using API call templates) to just explicitly specify that it should use the default.

I'd also need to set it back to default later.


How can I specify that the default value be set.


I'm testing these requests in Postman and eventually building them into a Java application.

2 answers

0 votes

You can't set a null value when you are explicitly calling the field itself to have a value.  By default in Jira, most custom fields that don't have any value will remain with a null or empty value for this field in the database level.  But there is not a way to call that field to have a value and just pass it a null here. 

It looks like you have already explored some other alternatives such as simply not including that field to be defined when the issue is created by removing it from the rest call.

I understand there are some other templates in play here so perhaps that isn't the ideal solution here.

Alternative to that, you might be able to get around this problem by changing the configuration of the custom field in Jira.  Right now your custom field looks something like this in the Jira UI under Issues -> Custom Fields:


There are a couple of different changes you could make to this field in order get around this.

1: You could set a default value for this field here.  That way you don't have to set a value in your rest call when creating the issue for issues unless the issue needs to have a different value here

2: You could create a new option for this field, and call it something like "unset" or "none".

Or you could do both of these steps.  In which case you could then use the rest call to set the field value to "none".  The difference here though is that this issue would have an actual value for that field when it is created as compared to being a true Null.   It might not make a difference, but it is a subtle change that is worth noting.

I also ran into this situation and found

: null,

will 'reset' the custom filed to null value.

I am using the jira rest api call.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Thursday in Jira

Updates to jira.atlassian.com give you visibility into what's coming in Jira Server and Data Center

Hello, Community! My name is Gosia and I'm a Product Manager on Jira Server and Data Center here at Atlassian. Since 2002 when we launched our public issue tracker, jira.atlass...

424 views 1 13
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you