Create a Set of Values
Use the REST API to create a reusable set of values that can be assigned to a custom field. In the REST API, a set of values is represented by a bundle entity.
This use case creates an enum bundle. You can use the same pattern with other bundle types, such as BuildBundle, OwnedBundle, StateBundle, and VersionBundle.
For details about enum bundles, see Enum Bundles.
Summary
To create a set of values, send a POST request to the bundle endpoint for the target field type:
Step-by-Step
To create an enum set of values
Prepare the request body with the name of the bundle and the values that you want to add to it.
{ "name": "Customer Impact", "values": [ {"name": "Low", "$type": "EnumBundleElement"}, {"name": "Medium", "$type": "EnumBundleElement"}, {"name": "High", "$type": "EnumBundleElement"} ], "$type": "EnumBundle" }Create the enum bundle with a
POSTrequest.curl -X POST 'https://example.youtrack.cloud/api/admin/customFieldSettings/bundles/enum?fields=id,name,values(id,name)' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer <YouTrack_token>' \ -H 'Content-Type: application/json' \ -d '{ "name": "Customer Impact", "values": [ {"name": "Low", "$type": "EnumBundleElement"}, {"name": "Medium", "$type": "EnumBundleElement"}, {"name": "High", "$type": "EnumBundleElement"} ], "$type": "EnumBundle" }'Check the response body. If the request is successful, the response contains the created bundle.
{ "values": [ { "name": "Low", "id": "67-12", "$type": "EnumBundleElement" }, { "name": "Medium", "id": "67-13", "$type": "EnumBundleElement" }, { "name": "High", "id": "67-14", "$type": "EnumBundleElement" } ], "name": "Customer Impact", "id": "86-10", "$type": "EnumBundle" }
As a result, you have created an enum bundle that can be referenced by REST API requests. The bundle is not available in issues until you assign it to a project custom field.
To create an enum custom field with this set of values and add it to a project, see Create an Enum Custom Field and Add It to a Project. To replace the set of values for an existing project custom field, see Replace the Set of Values for a Custom Field.