I'm able to create new Story via POST
to /VersionOne/rest-1.v1/Data/Story
with corresponding XML payload. Setting all attributes (including relational) works like a charm. However I'm unable to figure out how to add a Link
asset to the Story
asset.
When I try POST
ing to /VersionOne/rest-1.v1/Data/Link
with following XML payload:
<Asset href='/VersionOne/rest-1.v1/New/Link'>
<Attribute name='AssetType' act='set'>Link</Attribute>
<Relation name='Asset' act='set'>
<Asset href='/VersionOne/rest-1.v1/Data/Story/123' idref='Story:123'/>
</Relation>
<Attribute name='OnMenu' act='set'>true</Attribute>
<Attribute name='URL' act='set'>http://my.example.com</Attribute>
<Attribute name='Name' act='set'>My Link Title</Attribute>
</Asset>
The server however returns:
<Error href="/VersionOne/rest-1.v1/Data/Link">
<Message>Violation'Readonly'Link.AssetType</Message>
<Exception class="VersionOne.DataException">
<Message>Violation'Readonly'Link.AssetType</Message>
</Exception>
</Error>
Seems like adding links is prohibited but actually I can add Link
s via the standard web interface without issues.
My original idea was to create Link
asset first and then update the Story
with respective relational attribute pointing to that Link
asset.
Any ideas anyone?
Thanks!
(I'm using JavaScript/jQuery
)
My bad. The <Attribute name='AssetType' act='set'>Link</Attribute>
attribute in the POST
payload is obviously wrong - it is trying to set the asset's type (link) which does not make sense since I'm stating the type in URL
already. It works perfectly without the attribute (as expected).