It's all about the answers!

Ask a question

How to create ArtifactRef object from existing uri

Jake Hadley (132) | asked May 17 '21, 4:33 p.m.
edited May 17 '21, 4:35 p.m.

 I'm working on creating a tool to operate on all artifacts in all modules. Currently, it appears that the RM api provides capability to access only 1 module worth of artifacts, so I'm investigating a workaround. This includes getting each module's uri and operating on each individual module in sequential order. Am I able to generate/get an ArtifactRef from a uri?

If I can do this, then I can operate on all modules necessary at once, rather than having to navigate to each module while subscribed to the ARTIFACT_OPENED event to perform the action that I want.

Accepted answer

permanent link
Bartosz Chrabski (3.4k12648) | answered May 17 '21, 4:56 p.m.

Please check following code. It should return the object.

let tmp = new RM.ArtifactRef(URI, COMPONENT_URI, null, FORMAT);
Jake Hadley selected this answer as the correct answer

Jake Hadley commented May 17 '21, 5:00 p.m.

 Awesome! Is there any documentation showing that the parameters have to be in that order?

Davyd Norris commented May 17 '21, 5:50 p.m.
I'm assuming that the null can also be a moduleUri?

I was only just trying to do this last night and kept getting "ArtifactRef is not a constructor" errors so will be trying this out this morning!

Bartosz Chrabski commented May 18 '21, 6:06 a.m.


Yes null can be a moduleURI. I found it when I started debuging IBM library. This code works because I am using this in my appications.

Bartosz Chrabski commented May 18 '21, 6:07 a.m.


Display any existing artifactRef and You will see the order of the parameters. I was not able to find any documentation and this is outcode of my own research.


Your answer

Register or to post your answer.