Reputation: 83
Successfully using the VersionOne API to create stories using the REST API. Unfortunately the description field seems to strip all xml tags. (The example online uses
, but this does not work)
So have something like:
POST /VersionOne/rest-1.v1/Data/Story HTTP/1.1
Content-Type: text/xml; charset=utf-8
Content-Length: 221
<Asset>
<Attribute name="Name" act="set">New Story</Attribute>
<Relation name="Scope" act="set">
<Asset idref="Scope:0" />
</Relation>
<Attribute name="Description" act="set">
<p>first line</p>
<p> second line</p>
</Attribute>
</Asset>
Any way to insert formatting? Basically we are using this as a story to test our recently created artifact and want to refer to the defects/stories that are included in the artifact. Any help much appreciated, thanks.
Upvotes: 0
Views: 639
Reputation: 974
You could try to use CDATA sections, like this:
<Asset>
<Attribute name="Description" act="set">
<![CDATA[
<xml>code goes here</xml>
]]>
</Attribute>
</Asset>
When I do this against our public test server: https://www14.v1host.com/v1sdktesting/http.html, and POST to the default Scope/0, I get this:
<?xml version="1.0" encoding="UTF-8"?>
<Asset href="/v1sdktesting/rest-1.v1/Data/Scope/0/21470" id="Scope:0:21470">
<Attribute name="Description"><xml>code goes here</xml> </Attribute>
</Asset>
Does this help?
Upvotes: 0
Reputation: 37
Jon, you'll need to XML-encode the text value of Description. Two possibilities are:
<Asset>
<Attribute name="Name" act="set">New Story</Attribute>
<Relation name="Scope" act="set">
<Asset idref="Scope:0" />
</Relation>
<Attribute name="Description" act="set">
<p>first line</p>
<p> second line</p>
</Attribute>
</Asset>
or
<Asset>
<Attribute name="Name" act="set">New Story</Attribute>
<Relation name="Scope" act="set">
<Asset idref="Scope:0" />
</Relation>
<Attribute name="Description" act="set"><![CDATA[
<p>first line</p>
<p> second line</p>
]]></Attribute>
</Asset>
Upvotes: 1