How to set select lists (single, multiple, cascading), radio or checkboxes on create issue with REST

This small how-to is all about setting custom fields on creating an issue. Apart from the customfield_xxxxx elements, only the minimum required fields are set.

The REST API endpoint

POST https://myjiradomain.com/rest/api/2/issue

HTTP Headers to be set

  • Content-Type: application/json
  • User-Agent: x (required only, if you get an XSRF from browser)
  • Origin: https://myjiradomain.com (required only, if you get an XSRF)

JSON request body for Select List (single choice) / Radio Buttons

{
"fields": {
  "project": {
"key": "REST"
},
  "summary": "Issue created from REST API",
  "issuetype": {
"id": "1"
},
  "customfield_10100": {
"value": "First"
}
  }
}

JSON request body for Select List (multiple choices) / Checkboxes

{
"fields": {
"project": {
"key": "REST"
},
"summary": "Issue created from REST API",
"issuetype": {
"id": "1"
},
"customfield_10200": [
{
"value": "Apple"
},
{
"value": "Banana"
}
]
}
}

JSON request body for Select List (cascading)

{
"fields": {
  "project": {
"key": "REST"
},
  "summary": "Issue created from REST API",
  "issuetype": {
"id": "1"
},
  "customfield_10300": {
"value": "Mammal",
"child": {
"value": "Elephant"
}
}
  }
}

JSON request body for Select List (cascading) with 'none' on child option

{
"fields": {
  "project": {
"key": "REST"
},
  "summary": "Issue created from REST API",
  "issuetype": {
"id": "1"
},
  "customfield_10300": {
"value": "Mammal",
"child": null
}
  }
}

Tested with Jira Software Server 8.13.3.

7 comments

Srikanth Ganipisetty
Contributor
August 3, 2022

This article is good. Thanks @Thomas Deiler 

Srikanth Ganipisetty

Like Thomas Deiler likes this
Ian Hayse
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!
November 2, 2022

Thank you!  I was trying to overcomplicate updating a checkbox field.   For some reason, I thought there was an internal value for each checkbox that needed to be set.

wrong way:

    "customfield_10200": [
{
"value": "1000009"
},
{
"value": "1000010"
}
]

correct

    "customfield_10200": [
{
"value": "Apple"
},
{
"value": "Banana"
}
]
Majo Francis _MicroGenesis Techsoft_
Atlassian Partner
January 13, 2023

'Group Picker' Custom Field :

"customfield_10073":
{
"name" : "gname"
}

Debabrata Pramanik August 11, 2023

I have a asset object custom field, which I want to set during ticket creation. The following does not work there. The call goes through, but the custom field is still empty.

"customfield_10100" : [{"key" : "TEST-1"}]

 

Maximilian Floß January 29, 2024

@Thomas Deiler 

What is the code when both fields of cascading select list should be Emtpy/null?

 

{
"fields": {
  "project": {
"key": "REST"
},
  "summary": "Issue created from REST API",
  "issuetype": {
"id": "1"
},
  "customfield_10300": {
null,
"child": null
}
  }
}
Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 7, 2024

@Maximilian Floß Does your JSON work?

Melissa Nielsen September 26, 2024

Just wanted to chime in and say that if you also want to submit a child value in the cascading select list, you have to add "value" as shown here: 

cascading select list.png

Like Edimara Souza likes this

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events