We like to Fill a custom Field which is set as mandority for manuell Users via Rest API. I am struggeling to get the right value for the Drop Down selection to apply it into the Rest API.
Can you give me a hint!?
Hola Carsten,
@Gor Greyan's answer is the right direction: for a single-select dropdown custom field, Jira usually expects an option object, not just raw text.
The part I'd add is that you should first ask Jira what values that field accepts for the specific project and issue type. In Jira Data Center, you can use the create metadata endpoint for that:
/rest/api/2/issue/createmeta?projectKeys=ABC&issuetypeNames=Bug&expand=projects.issuetypes.fields
In the response, find your custom field, for example, customfield_00000, and look for allowedValues. That list should show the valid dropdown options Jira will accept.
Then send the custom field using the option value or ID. For example:
{
"fields": {
"project": {
"key": "ABC"
},
"issuetype": {
"name": "Bug"
},
"summary": "Created through REST API",
"customfield_00000": {
"value": "High Impact"
}
}
}
If Jira still rejects the value, use the option ID from allowedValues instead:
{
"fields": {
"customfield_00000": {
"id": "99999"
}
}
}
The important thing is to use the custom field ID, like customfield_00000, and one of the allowed dropdown values for that project and issue type. The field name you see on the screen may not be sufficient for the REST payload.
Thanks,
James
Hi @Carsten Jeschner
Thanks for the question
For a single-select drop-down custom field, the REST API usually expects the selected option, not plain text. For example:
"customfield_12345": {
"value": "Option Name"
}
If that doesn't work, could you share your JSON payload and the error you're receiving? That will help identify the expected format.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.