Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Can we import/get data by API, list data in field type "single choice" (Custom field)?

MQZ-M. Iqbal Rizaldi January 30, 2024

Hi everyone, I have more than 200 data to write down in field type "single choice" (Custom Field) . Is there any workaround to import it or get by API to make it faster? (In picture below there is only 1 button add to list the data)

SINGLE CHOICE.png

1 answer

1 accepted

4 votes
Answer accepted
Luiz Ricardo Pereira da Silva January 30, 2024

Hello @MQZ-M. Iqbal Rizaldi ,

You can use the REST API:


https://your-domain.atlassian.net/rest/api/3/field/{fieldId}/context/{contextId}/option

which can be consulted in this article:

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-custom-field-options/#api-rest-api-3-field-fieldid-context-contextid-option -post


  • However, I can suggest a solution that worked well for me.
  • A test project will be required
  • Create a project and add a list field to the creation screen;
  • Create a CSV file containing the summary field and the list type field (To help, create a model issue, feed the list field with a value and export via CSV);
  • Place a generic summary and a different value for the list field in each line of this file;
  • Import the CSV file;

This will force a different value created in the list field for each issue it creates in this import.
I believe it is an easier option, as via API it is complicated to put all the values in a single call.
In the end, 200 issues will be created in the test project and 200 different options in the list field.


Please tell me if this solution helped you!


If you need details regarding the process of creating options in a list field via Import CSV, you can answer me here.

MQZ-M. Iqbal Rizaldi January 31, 2024

Oh nice thank you so much, both solution seems good.

But how do I know "fieldID" and "contextID" if I want to try API way

Luiz Ricardo Pereira da Silva January 31, 2024

In the Browser itself, in the Issues - Custom fields option in the global menu.

image.png

When accessing the field, your ID will be with you in the URL:

image.png

The same happens with Context:
image.png
If you want, you can also use a GET to redeem the IDs

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-custom-field-options/#api-rest-api-3-field-fieldid-context-contextid-option

https://your-domain.atlassian.net/rest/api/3/field/{fieldId}/context/{contextId}/option

MQZ-M. Iqbal Rizaldi January 31, 2024

Thank you so much, what a knowledge!

Suggest an answer

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

Atlassian Community Events