已成功使用VersionOne接口通过REST API创建故事。不幸的是,description字段似乎剥离了所有xml标记。(在线示例使用
,但这不起作用)
所以要有这样的东西:
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>有什么方法可以插入格式吗?基本上,我们使用它作为一个故事来测试我们最近创建的工件,并希望引用工件中包含的缺陷/故事。任何帮助都非常感谢,谢谢。
发布于 2013-08-20 02:41:13
Jon,您需要对Description的文本值进行XML编码。有两种可能性:
<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>或
<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>发布于 2013-08-20 02:49:02
您可以尝试使用CDATA节,如下所示:
<Asset>
<Attribute name="Description" act="set">
<![CDATA[
<xml>code goes here</xml>
]]>
</Attribute>
</Asset>当我对我们的公共测试服务器https://www14.v1host.com/v1sdktesting/http.html执行此操作,并将其发送到默认作用域/0时,我得到如下结果:
<?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>这有帮助吗?
https://stackoverflow.com/questions/18318888
复制相似问题