I am getting error in the creation of an asset of type 'Epic' using version one API. Here is my request URL:
URL:<Domain>/rest-1.v1/Data/Epic
Request body:
<?xml version="1.0" encoding="UTF-8"?>
<Asset href="<Domain>/rest-1.v1/New/Epic">
<Attribute name="Name" act="set">Test Epic Creation</Attribute>
<Relation name="Category">
<Asset href="<Domain>/rest-1.v1/Data/EpicCategory/207" idref="EpicCategory:207"/>
</Relation>
<Attribute name="Category" act="set">EpicCategory:207</Attribute>
<Attribute name="Status" act="set">EpicStatus:64</Attribute>
<Attribute name="Custom_Product" act="set">Custom_Product:0</Attribute>
<Attribute name="Description" act="set">Test Epic Creation</Attribute>
<Relation name="Scope" act="set">
<Asset href="<Domain>/rest-1.v1/Data/Scope/189675" idref="Scope:189675" />
</Relation>
<Attribute name="StrategicThemes" act="add">
<Value>StrategicTheme:5158</Value>
</Attribute>
</Asset>
Here is what I am getting:
<Error href="<Domain>/rest-1.v1/Data/Epic">
<Message>Server Error</Message>
<Exception class="System.NotSupportedException">
<Message>Cannot SetValue on Multi-value attribute. Use AddValue and RemoveValue.</Message>
</Exception>
</Error>
Problem I am facing is in setting the value of StrategicThemes attribute which is a multivalue attribute.
I am stuck. Kindly help.
This is because values can be added to multi-value attributes and cannot be set. Value is set only for single-value attributes. Also the code for adding values to the StrategicThemes attribute is incorrect.
<Attribute name="StrategicThemes" act="add">
<Value>StrategicTheme:5158</Value>
</Attribute>
Thus the error in question.
The values for multi-valued attribute in should be added as:
<Relation name="StrategicThemes">
<Asset idref="StrategicTheme:5158" act="add"/>
</Relation>