How do I get the GUID when submitting a new asset?
Sorry for the newbie question but I'm not sure how this is supposed to work. I successfully uploaded an asset to RAM using the custom ant library but now I need the URL to that same asset. It seems pretty straightforward: http://ramserver/ram/oslc/assets/<guid>/<version>. The problem is, how do I get the GUID!
<ram:search server="ramServer" community="${ram.asset.community}" version="${ram.asset.version}"
name="${ram.asset.name}"/>
Accepted answer
Second, you don't need to search to get the guid. When the submit occurs you can have an ANT property set with the guid of the new asset. See Submit task and look at the "guidProperty" setting on the submit.
Comments
Well, that's just ideal:) But could you help with one follow-up question? I'm publishing the asset using the same task as is used in the ramPublishAsset.xml file (from the ramclient.zip and referenced in Carlos Ferreira's RAM/ant tutorial) and it actual uses ram:modify rather than ram:submit. It also has that guidProperty. I just tried it, it does exactly what you said which is exactly what I needed. Is there any reason to use ram:modify rather than ram:submit or vice versa when publishing a new asset?
P.s. . . I ran my same search that I referred to in the OP and I still don't get any results. Though your answer meets my need (thank you!), for future generations could you help with the original ram:search question so that we have an answer to that on the same thread? Or if you could modify the question to "How do I get the GUID when submitting a new asset?" then I can submit the ram:search question separately.
Modify is for modifying an existing asset. Submit is only for creating a new asset.
You can't modify an asset with submit and you can't create an asset (other than a new version of an existing asset, leaving the existing asset version still existing after the create new version) with modify.
1 vote
Comments
Andy Jewell
Oct 24 '13, 7:00 p.m.Sorry with that post, somehow the snippet got mangled. Try this: