Delete a Value from a Set
Use the REST API to delete a value from a set of values for a custom field. In the REST API, a set of values for a custom field is represented by a bundle entity.
This use case deletes an enum value from an enum bundle. You can use the same pattern with other bundle element types, such as BuildBundleElement, OwnedBundleElement, StateBundleElement, and VersionBundleElement.
Summary
When you have the required IDs, delete the value by sending a DELETE request to this endpoint:
Step-by-Step
To delete an enum value from a set
Get the list of enum bundles and their values. See Enum Bundles.
curl -X GET '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'In the response, locate the bundle and value that you want to delete. This example uses the
Prioritiesbundle with the entity ID86-125and theMinorvalue with the entity ID67-5.[ { "values": [ { "name": "Major", "id": "67-2", "$type": "EnumBundleElement" }, { "name": "Normal", "id": "67-3", "$type": "EnumBundleElement" }, { "name": "Minor", "id": "67-5", "$type": "EnumBundleElement" } ], "name": "Priorities", "id": "86-125", "$type": "EnumBundle" } ]Delete the value from the bundle.
curl -i -X DELETE 'https://example.youtrack.cloud/api/admin/customFieldSettings/bundles/enum/86-125/values/67-5' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer <YouTrack_token>' \ -H 'Content-Type: application/json'If the request is successful, the server responds with the
200 OKstatus.Optional. Check the list of values in the bundle.
curl -X GET 'https://example.youtrack.cloud/api/admin/customFieldSettings/bundles/enum/86-125?fields=id,name,values(id,name)' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer <YouTrack_token>' \ -H 'Content-Type: application/json'The deleted value is no longer listed in the response.
As a result, the value is deleted from the set of values.