Update an asset
Updating assets involves sending HTTP POST requests to rest-1.v1/Data with an XML payload.
Getting Started
- Have an HTTP Client.
- Obtain an API token.
Update a Simple Attribute
Updating a value type on an asset is accomplished by marking the attribute with act="set"
, and filling in the new value in the element's text. The following updates the Phone
attribute.
POST /VersionOne/rest-1.v1/Data/Member/20 HTTP/1.1
Content-Type: application/xml
<Asset>
<Attribute name="Phone" act="set">555-555-1212</Attribute>
</Asset>
The response will be similar to the following.
<Asset href="/VersionOne/rest-1.v1/Data/Member/20/173" id="Member:20:173">
<Attribute name="Phone">555-555-1212</Attribute>
</Asset>
Update a Single-Value Relationship
Updating a single-value relationship on an asset is accomplished by marking the attribute with act="set"
, and filling in the idref of the enclosed Asset element with the referenced OID Token. The following changes the Owner
of the root project.
POST /VersionOne/rest-1.v1/Data/Scope/0 HTTP/1.1
Content-Type: application/xml
<Asset>
<Relation name="Owner" act="set">
<Asset idref="Member:20" />
</Relation>
</Asset>
Conversely, the way to unset a single-value relationship is to simply pass an empty element. The following changes the Owner
to nobody.
POST /VersionOne/rest-1.v1/Data/Scope/0 HTTP/1.1
Content-Type: application/xml
<Asset>
<Relation name="Owner" act="set">
</Relation>
</Asset>
Update a Multi-Value Relationship
Updating a multi-value relationship on an asset is accomplished by marking enclosed Asset
elements with act="add"
or act="remove"
, and filling in the idref
of the enclosed Asset
element with the referenced OID Token. The following adds one Member
and removes another Member
from the root project.
POST /VersionOne/rest-1.v1/Data/Scope/0 HTTP/1.1
Content-Type: application/xml
<Asset>
<Relation name="Members">
<Asset idref="Member:1000" act="add"/>
<Asset idref="Member:1001" act="remove"/>
</Relation>
</Asset>