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.