Are we suppose to create a new uri while adding an existing artifact in module using DNG module API?
I'm trying to add an existing artifact to a module using DNG module API. Actually I'm successfully able to add it. But while new entry for each artifact, we are suppose to give the uri. I think this uri should be unique and non-existing one. when creating a new uri, what format do I suppose to use to maintain unique one ? Because sometimes it's throwing an error.
{
"type": "dng_module:Binding",
"isHeading": false,
"childBindings": []
}
|
Accepted answer
Hello
You must first create the base artifact, then add it in the module structure, using the base artifact URI.
{
"type": "dng_module:Binding",
"component": "https://xyz.com/rm/cm/component/_Q8TTYG78Ee2lPbY4PFEKxg",
"isHeading": false,
"boundArtifact": <URI of the newly created artifact> ,
"childBindings": []
}
For the uri, use the following pattern:
<Module structure resource URI> + "#" + <sequential number> https://<elmserver>/rm/resources/<module UUID>/structure#<SeqNum> Sowndhar S selected this answer as the correct answer
Comments
Sowndhar S
commented May 14, 11:59 p.m.
Using this pattern (<Module structure resource URI> + "#" + <sequential number> ), I'm able to form new url.
> <Module structure resource URI> + "#" + <sequential number>
AFAIK it's not that specific form of URI that makes it work, what's important is that it's not a real actual existing URI, for example it shouldn't be an existing binding uri. As Ralph says the uri could be "https://me.com/garbage" and it would work.
Pierre Bentkowski
commented May 15, 7:57 a.m.
The URL of the new Bindings must take the form of a fragment URL based on the structure. The fragment URLs must be unique within the submitted structure.
In my example python I use a fixed dummy url https://clmwb.com:9444/rdm/resources/_4sscEb43EeeD0-df1VhHuw/structure#1 |
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.
Comments
I am not sure if this is relevant or not.
I have run into situations, where the API required an URI that was not null in some operations e.g. POST. In the case I remember, it was absolutely irrelevant what the URI was, it needed to be an URI e.g. https://nowhere.nothing/ would be ok . In my case the process created a new URI, that was returned in the location header and/or the response body. The one that I passed was pretty much ignored and irrelevant. The only reason for the URI was that it was expected by the API and otherwise the API would throw a null pointer in the parsing process.
BTW If you want/expect others to answer your questions, provide the minimum amount of information. Tool, version number. If API, complete request, plus headers, etc. Do not provide information like "Because sometimes it's throwing an error". If there is an error, show it.