It's all about the answers!

Ask a question

Are we suppose to create a new uri while adding an existing artifact in module using DNG module API?


Sowndhar S (152) | asked May 14, 4:24 a.m.

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": []
  }


Comments
Ralph Schoon commented May 14, 8:31 a.m. | edited May 14, 8:41 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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. 


Ralph Schoon commented May 14, 8:44 a.m. | edited May 14, 8:44 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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
Pierre Bentkowski (106517) | answered May 14, 2:55 p.m.
edited May 14, 2:58 p.m.
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

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.

Thank you!


Ian Barnard commented May 15, 5:37 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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

Ian Barnard commented May 16, 5:37 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

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.