How to update a Select List (multiple choices) custom field in Jira using REST API ?
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
How to update an existing custom field of type Select List (multiple choices) of an issue in Jira using REST API ?
Environment
Jira on Data Center.
Solution
Retrieve the custom field ID.
Either query through the database.
1
select id from customfield where cfname='<name of customfield>'
You can also navigate to the Custom Fields page, click the cog icon for your custom field, and hover over the Delete button. The ID will be displayed at the bottom left of the screen.
The custom field will have a list of Options(values) available for it. Fetch the option IDs of the values available for this custom field.You can fetch them using the REST API endpoint for custom fields by using :
1
GET /rest/api/latest/customFields/{customFieldId}/options
Example (using curl):
1
curl -u username:password -X GET -H "Content-Type: application/json" http://localhost:49120/j9120/rest/api/latest/customFields/10201/options
Form the JSON payload containing the updates you want to make. The payload should include the custom field with the option IDs you want to set. In this example, customfield_10201 is the custom field ID, and 10103 and 10104 are the IDs of the options you want to set for this field.
1 2 3 4 5
{ "fields": { "customfield_10201": [{ "id": "10103"}, {"id": "10104"}] } }
You may use cURL, Postman REST Client or any other REST API client to perform the Update Issue PUT request. For all our Jira Data Center / Server REST API refer Atlassian Developer REST APIs
Example (using curl):
1 2 3 4 5 6 7
curl -u username:password -X PUT -H "Content-Type: application/json" http://localhost:49120/j9120/rest/api/latest/customFields/10201/options -d “@file.json" file.json: { "fields": { "customfield_10201": [{ "id": "10103"}, {"id": "10104"}] } }
The returned response will show 204 No Content status, which means the Issue is successfully updated.
Was this helpful?