Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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.

Data Entry :

{
      "type": "dng_module:Binding",
      "isHeading": false,
      "childBindings": []
  }

0 votes

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.


Accepted answer

Permanent link
Hello

You must first create the base artifact, then add it in the module structure, using the base artifact URI.

{
      "type": "dng_module:Binding",
      "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

1 vote

Comments

Using this pattern (<Module structure resource URI> + "#" + <sequential number> ), I'm able to form new url.

Thank you!

<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.


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.

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,941

Question asked: May 14 '24, 4:24 a.m.

Question was seen: 572 times

Last updated: May 16 '24, 5:37 a.m.

Confirmation Cancel Confirm