Retrieving All Option IDs for a Multi-Select Custom Field in Jira via API

Oren Arazi
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!
October 29, 2024

Hello everyone,

I'm working with Jira's REST API to manage custom fields. I'm trying to fetch all option IDs from a Multi-Select custom Field.

 

My goal is to fetch all option IDs values to programmatically update issues in bulk. Here's what I've tried so far:

  1. Direct Endpoint for Field Options: I attempted using the `/rest/api/2/field/{field_id}/context/option` endpoint, but it returned a 400 error. It seems this might not be the correct endpoint for multi-select fields
  2. I would like to avoid the manual process of setting each option one by one in the UI to retrieve their IDs individually.

Has anyone successfully retrieved all option IDs for a multi-select field using the Jira API? 

 

1 answer

1 accepted

0 votes
Answer accepted
Oren Arazi
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!
October 29, 2024

Solved!

  1. Initially, I tried to fetch all option IDs by using the `/rest/api/2/field/{field_id}/context/option` endpoint directly. However, this led to a 400 error, likely because this endpoint doesn’t directly handle multi-select fields in the way I needed.
  2. To work around this, I adjusted my approach. First, I used the `/rest/api/3/field/{customfield_id}/context` endpoint to get the **context ID** for the custom field. This step was crucial, as it provided the specific context required to retrieve the options. With the context ID in hand, I then used the `/rest/api/3/field/{customfield_id}/context/{context_id}/option` endpoint to fetch the list of options, which successfully returned the option IDs.
  3. By first retrieving the context ID and then pulling the options within that context, I was able to get the option IDs programmatically.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events