It's all about the answers!

Ask a question

Obtain artifact Wrapped Resource link from RM extension


Giovanni Tenaglia (111) | asked Mar 08 '22, 9:05 a.m.
edited Mar 08 '22, 9:29 a.m.

Hello,
I would like to know if there is an easy way, using the Javascript RM API extensions, to retrieve the link to the wrapped resource (e.g. https://xxxxx.com/rm/wrappedResources/WR_tDcmoZrJEeyk_I2zbQzuyg) contained inside of an artifact, for example a picture.

Given the reference of the articfact, the .toUri() function only provides the link to the artifact, not to its content


Comments
Ralph Schoon commented Apr 10, 2:49 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

If you have to comment on an old question, please use a comment and not an answer. Now this question looks as it has an answer which it does not.

One answer



permanent link
Diana Kraaijeveld (57727) | answered Apr 10, 4:32 a.m.
JAZZ DEVELOPER
edited Apr 10, 4:34 a.m.
Hello Giovanni,
If you upload an artifact (for example an image) to a folder in RM, it will create an artifact (the wrapper resource) that references the actual image (the image would be the wrapped resource).
So lets say the URL of the artifact that was created when uploading the image, is https://xxxxx.com/rm/resources/WR_tDcmoZrJEeyk_I2zbQzuyg
Then you could change that URL to https://xxxxx.com/rm/wrappedResources/WR_tDcmoZrJEeyk_I2zbQzuyg and you would have the URL to the wrapped resource itself.
In ERM Doors Next v7.x*, the UID (WR_tDcmoZrJEeyk_I2zbQzuygc in this example) is usually the same for the wrapped resource and the wrapper resource. So perhaps you can use fact that in your script?

*Note that in older RM versions these UID's are not the same. So this only works for v7.x


Comments
Giovanni Tenaglia commented Apr 10, 6:35 a.m.

Thank you, but this does not seem to work in my case even i'm using version 7.0.3.
Trying to access the resources with the modified URL gives the following error:

Error 400: Bad Request

Propagated exception; original message [InternalServerErrorException: Propagated exception; original message [ClassCastException: com.ibm.rdm.service.artifacts.model.impl.Binding incompatible with com.ibm.rdm.service.artifacts.model.IWrapperResource]]


In the meantime we found the workaround to import the pictures inside a Word table, in this way the HTML table in the generated artifact will contain a "correct" Wrapped Resource URL allowing to directly download the picture if needed

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.