YouTrack REST API – Add new value to Enumeration Bundle

I’m trying to add a new value to a “Enumeration Bundle” as described here: https://www.jetbrains.com/help/youtrack/standalone/PUT-Value.html?search=rest


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 https://github.com/JetBrains/YouTrackSharp

1
1 comment

You are trying to use resource that creates new bundle to add value there, and it requires Application/xml  content type. (doc about resource : https://www.jetbrains.com/help/youtrack/standalone/PUT-Enumeration.html?search=rest)

To add value to bundle you need to do something like  

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

 

0

Please sign in to leave a comment.