New Asset Templates
A new asset template is an XML response that contains suggested attribute values for a new asset. These values can be changed, and new attributes added; then the whole template can be posted for saving.
Often a new asset should be created in the "context" of another asset. For example, if you ask for a new Story asset in the context of an Issue asset, the new Story asset will carry over some attributes from the Issue. A few of these attributes are the Name, Description, Scope, and a relationship back to the originating Issue. The same can be done with a Story in the context of a Request with similar attributes being carried across.
One example of a new asset template is asking for a new Timebox asset. When a new Timebox asset is asked for in the context of a Scope asset, it will automatically come with a suggested Name, as well as a StartDate and EndDate. This saves the client from having to calculate the StartDate and EndDate attributes.
These examples demonstrate how to ask for new assets. They should be viewable using a web browser capable of displaying XML data.
How to Get a New Story Asset Template in the Context of a Scope Asset
Use this URL to get a new Story template.
~/rest-1.v1/New/Story?ctx=Scope:1000
The XML Response will look something like this.
<Asset href="/VersionOne/rest-1.v1/New/Story">
<Relation name="Scope" act="set">
<Asset href="/VersionOne/rest-1.v1/Data/Scope/1000" idref="Scope:1000" />
</Relation>
</Asset>
Note how the response contains a pending change for the Scope attribute.
This Story asset is not saved yet. To save it (creating a new Story asset), you must add a Name attribute, and POST it to ~/rest-1.v1/Data/Story as described in How to create a new asset.
How to Get a New Story Asset in the Context of a Request Asset
Use this URL to get a new Story template.
~/rest-1.v1/New/Story?ctx=Request:1684
The XML Response will look something like this.
<Asset href="/VersionOne/rest-1.v1/New/Story">
<Relation name="Scope" act="set">
<Asset href="/VersionOne/rest-1.v1/Data/Scope/1009" idref="Scope:1009" />
</Relation>
<Attribute name="Description" act="set"><P>When an item's status is updated, alert the owner of the change in status value.</P></Attribute>
<Attribute name="RequestedBy" act="set">Joe Customer</Attribute>
<Attribute name="Name" act="set">Integrate with Palm Handheld</Attribute>
<Relation name="Requests">
<Asset href="/VersionOne/rest-1.v1/Data/Request/1684" idref="Request:1684" act="add" />
</Relation>
</Asset>
Note how the response contains many attributes carried over from the Request asset into the pending Story asset. Also note how the Story will have a relationship set to point back to the Request that it was created from.