Hello,
I want to show field options in a drop-down to a normal user.
The get options for a custom field API call (/rest/api/3/customField/{fieldId}/option
) is deprecated and becomes unavailable on May 8th.
I find two alternative calls in the documentation that can help:
The problem being, the documentation states that these API calls require Administer Jira global permission . So I cannot use these API calls from a normal user.
So my question is : how can a normal user receive the options of a custom field?
Hi @edwin_ro,
nice to hear from you.
I have read your request carefully and I think that the deprecation has nothing in common with the issue you mentioned for normal users. Note that an old endpoint (GET /rest/api/3/customField/{fieldId}/option
) also requires global admin permission. What is more, it returns only options from the global context so in many use cases improper options can be displayed.
The good news for you is that we have another endpoint that can be useful in that case. Please get familiar with GET /rest/api/3/issue/{issueIdOrKey}/editmeta
endpoint (docs).
For my testing instance, it returns all allowed_values
that are allowed in that project and the API is context-aware.
I hope that the solution I provided helps you.
Do not hesitate to reach me if you have further questions.
1 Like
Hello @BeataSzturemska ,
Thank you for your reply, and the information shared.
Unfortunately, GET /rest/api/3/issue/{issueIdOrKey}/editmeta
would not work in this case because it requires an issue id or key within a Jira project. In our use case, we need to display the options even when no issue is created yet in the project. It is likely that our app creates the first issue for a specific issue type in a project, and uses the field option setting in that process.
With kind regards,
Edwin Rozie
On a side note :
The drop down option is used as a sort of filter that the user can configure. And the reason we cannot use the Jira filter API itself is because it is not possible to create an issue that respects a filter (sets the fields in the same way the query is build, by simply passing a JQL query. Note that the JQL query could be complex).
I suspect that /rest/inline-create/1.0/issue could work to create an issue with a JQL query, as this seems the way a scrum board does it when creating a new issue while passing the Jira Query, but this end point is not part of the API, hence not supported nor documented. And if made public, we can only use it if a similar solution exists for Data Center as well (requested in ticket for DC)
Give me one more try. 
What do you think about GET /rest/api/3/issue/createmeta?projectKeys=NI&expand=projects.issuetypes.fields
.
2 Likes
Yes, that should work, thank you very much @BeataSzturemska !