VersionOne rest API描述属性格式

VersionOne rest API描述属性格式,api,rest,versionone,Api,Rest,Versionone,成功使用VersionOne API使用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=

成功使用VersionOne API使用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>
POST/VersionOne/rest-1.v1/Data/Story HTTP/1.1
内容类型:text/xml;字符集=utf-8
内容长度:221
新故事
第一行

第二线


有没有办法插入格式?基本上,我们将此作为一个故事来测试我们最近创建的工件,并希望引用工件中包含的缺陷/故事。非常感谢您的帮助。

Jon,您需要对描述的文本值进行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"> 
          &lt;p&gt;first line&lt;/p&gt;
          &lt;p&gt; second line&lt;/p&gt;
        </Attribute>
</Asset>

新故事
p第一行/p
p第二行/p


新故事
第一行

第二线

]]>
您可以尝试使用CDATA区域,如下所示:

<Asset>
    <Attribute name="Description" act="set">
    <![CDATA[
        <xml>code goes here</xml>
    ]]>
    </Attribute>
</Asset>
,并发布到默认范围/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">&lt;xml&gt;code goes here&lt;/xml&gt; </Attribute>
</Asset>

xmlcode在这里/xml
这有用吗

<?xml version="1.0" encoding="UTF-8"?>
<Asset href="/v1sdktesting/rest-1.v1/Data/Scope/0/21470" id="Scope:0:21470">
        <Attribute name="Description">&lt;xml&gt;code goes here&lt;/xml&gt; </Attribute>
</Asset>