YouTrack REST API – Add new value to Enumeration Bundle

I’m trying to add a new value to a “Enumeration Bundle” as described here:

Whenever I try to add a value I receive a 415 status code as response with the following content:
"{\"value\":\"Unsupported Media Type\"}"

Requests to other endpoints work.

My Code:

// Works
var response = await client.GetAsync( "/rest/admin/customfield/bundle/Types" );
var c0 = await response.Content.ReadAsStringAsync();

const String newValue = "NewValue";
var queryString = new Dictionary<String, String>
{ "bundleName", "Types" },
{ "fieldValue", newValue },
{ "description", WebUtility.UrlEncode( "created by API call" ) },
{ "colorIndex", "9" }

// Fails with a 415 code
response = await client.PutAsync( $"/rest/admin/customfield/bundle/Types/{newValue}", new FormUrlEncodedContent( queryString ) );
var c1 = await response.Content.ReadAsStringAsync();

Client is a HttpClient crated by using YouTrackSharp

1 comment
Comment actions Permalink

You are trying to use resource that creates new bundle to add value there, and it requires Application/xml  content type. (doc about resource :

To add value to bundle you need to do something like  

await client.PutAsync( $"/rest/admin/customfield/bundle/Types/" + newValue + "?description=" + description+ "&colorIndex=9");



Please sign in to leave a comment.