user25317565
user25317565

Reputation: 11

How do I use the YouTrack API to retrieve all the selectable options or values available for each custom field in a specific project?

I need to have dropdown menus for each custom field that lists the available selectable values for each custom field, just like how it appears and works in YouTrack when you're on the page for an issue and you're able to click the drop-down menus next to each custom field to select a value. So I'll need to use the API to pull the selectable options/values available for each custom field in a given project so that I can use it to populate the dropdown menus in my program.

For example, specifically, I'd need to pull the list of selectable values of Assignee, Priority, and State for the issues in a given project.

Anyone know how to do this?

I can't seem to find anything in the documentation relating to this, the custom fields object doesn't seem to have a value storing its allowable values. Bing Copilot told me to use {api_url}/admin/projects/{project_id}/customFields/{field_id}/bundle, but that doesn't work.

Upvotes: 1

Views: 505

Answers (1)

Julia Bernikova
Julia Bernikova

Reputation: 36

The suggested endpoint should indeed return the enum values if you request them in the fields parameter like this: {api_url}/admin/projects/{project_id}/customFields/{field_id}/bundle?fields=values(name). Or, alternatively, you can access the values directly this way: {api_url}/admin/projects/{project_id}/customFields/{field_id}/bundle/values?fields=name. The EnumBundle article describes the bundle parameters in more detail. Add Value to a Set may also be useful though it describes a different scenario.

You can also use the {api_url}/admin/customFieldSettings/bundles/enum/{enum_id}?fields=values(name) endpoint if you first retrieve the bundle id. Make sure to use pagination for larger sets of values.

Upvotes: 0

Related Questions