How to get guid after I submit a new asset?
3 answers
Are you going to use the url from the Ant script?
regardless, here is how you will get the GUID
The following code will create an asset or modify if it is already existing - it also set assetID as a (Ant) reference to it. Note also the <ram:propertyHelper/> ... which helps you to "." introspect.
regardless, here is how you will get the GUID
The following code will create an asset or modify if it is already existing - it also set assetID as a (Ant) reference to it. Note also the <ram:propertyHelper/> ... which helps you to "." introspect.
<ram:server id="ramServer" url="${ram.url}" username="${ram.uid}" password="${ram.password}" />
<ram:propertyHelper/>
<ram:modify server="ramServer">
<ram:search name="${ram.asset.name}" version="${ram.asset.version}" />
<ram:asset id="assetID">
</ram:asset>
</ram:modify>
<echo message="Published: ${assetID.name} [${assetID.version}], GUID=${assetID.GUID}" />
Also, with both the <modify> and <submit> tasks, you can use the guidProperty parameter to get the GUID of the asset that was created/modified.
<ram:submit server="ramServer" guidProperty="asset.guid">
<ram:asset>
...
</ram:asset>
</ram:modify>
<echo message="GUID=${asset.guid}" />