Get module structure URI via rest API
![]() I want to get the module structure in json format using REST API in DNG version 7.0.2. I have referred to the page here: https://jazz.net/wiki/bin/view/Main/DNGModuleApiScenario2
But I am stuck because I am unable to get the module structure URI. (For e.g: https://clmwb.com:9444/rdm/resources/_4sscEb43EeeD0-df1VhHuw/structure)
Could someone please help me on how to get this URI via REST API?
|
Accepted answer
![]()
Ian Barnard (2.0k●6●13)
| answered Nov 29 '21, 5:37 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER edited Dec 16 '21, 7:09 a.m.
Hi
For the module structure API it's important to:
Once you've done the GET the XML includes the structure URL like:
For 7.0.2 I'd expect the UUID part of your module URL to start with MD_ as shown above - you can get this link through the browser by finding the module and then Share link to artifact.
When you GET the structure URL use the same headings as the first GET (i.e. for RDF), the result will be like:
<rdf:RDF
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:oslc_core="http://open-services.net/ns/core#"
xmlns:oslc_config="http://open-services.net/ns/config#"
xmlns:nav="http://com.ibm.rdm/navigation#"
xmlns:jazz_rm="http://jazz.net/ns/rm#"
xmlns:j.0="http://jazz.net/ns/rm/dng/module#"
xmlns:rm_types="http://www.ibm.com/xmlns/rdm/types/"
xmlns:process="http://jazz.net/ns/process#">
<j.0:Binding rdf:about="https://jazz.ibm.com:9443/rm/resources/MD__y90_0B6Eeuh3Iiax2L3Ow/structure">
<j.0:childBindings rdf:parseType="Collection">
<j.0:Binding rdf:about="https://jazz.ibm.com:9443/rm/resources/BI__yq5skB6Eeuh3Iiax2L3Ow">
<j.0:isHeading rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean"
>true</j.0:isHeading>
<oslc_config:component rdf:resource="https://jazz.ibm.com:9443/rm/cm/component/__J_JEEB6Eeuh3Iiax2L3Ow"/>
<j.0:boundArtifact rdf:resource="https://jazz.ibm.com:9443/rm/resources/TX__0wkYUB6Eeuh3Iiax2L3Ow"/>
<j.0:module rdf:resource="https://jazz.ibm.com:9443/rm/resources/MD__y90_0B6Eeuh3Iiax2L3Ow"/>
<j.0:childBindings rdf:parseType="Collection">
<j.0:Binding rdf:about="https://jazz.ibm.com:9443/rm/resources/BI__yq5s0B6Eeuh3Iiax2L3Ow">
<j.0:isHeading rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean"
>false</j.0:isHeading>
<oslc_config:component rdf:resource="https://jazz.ibm.com:9443/rm/cm/component/__J_JEEB6Eeuh3Iiax2L3Ow"/>
<j.0:boundArtifact rdf:resource="https://jazz.ibm.com:9443/rm/resources/TX__2GBIkB6Eeuh3Iiax2L3Ow"/>
<j.0:module rdf:resource="https://jazz.ibm.com:9443/rm/resources/MD__y90_0B6Eeuh3Iiax2L3Ow"/>
<j.0:childBindings rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
</j.0:Binding>
<j.0:Binding rdf:about="https://jazz.ibm.com:9443/rm/resources/BI__yq5tEB6Eeuh3Iiax2L3Ow">
<j.0:isHeading rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean"
>true</j.0:isHeading>
<oslc_config:component rdf:resource="https://jazz.ibm.com:9443/rm/cm/component/__J_JEEB6Eeuh3Iiax2L3Ow"/>
<j.0:boundArtifact rdf:resource="https://jazz.ibm.com:9443/rm/resources/TX__0dCdUB6Eeuh3Iiax2L3Ow"/>
<j.0:module rdf:resource="https://jazz.ibm.com:9443/rm/resources/MD__y90_0B6Eeuh3Iiax2L3Ow"/>
<j.0:childBindings rdf:parseType="Collection">
<j.0:Binding rdf:about="https://jazz.ibm.com:9443/rm/resources/BI__yq5tUB6Eeuh3Iiax2L3Ow">
<j.0:isHeading rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean"
....
If you get the structure with Accept: application/json you get a, err, JSON structure looking like this:
[ {
"type" : "dng_module:Binding",
"isStructureRoot" : "true",
"isHeading" : false,
"boundArtifact" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil",
"childBindings" : [ "https://jazz.ibm.com:9443/rm/resources/BI__yq5skB6Eeuh3Iiax2L3Ow", "https://jazz.ibm.com:9443/rm/resources/BI__yq5vEB6Eeuh3Iiax2L3Ow", "https://jazz.ibm.com:9443/rm/resources/BI__yq52kB6Eeuh3Iiax2L3Ow" ]
}, {
"type" : "dng_module:Binding",
"isHeading" : true,
"boundArtifact" : "https://jazz.ibm.com:9443/rm/resources/TX__0wkYUB6Eeuh3Iiax2L3Ow",
"childBindings" : [ "https://jazz.ibm.com:9443/rm/resources/BI__yq5s0B6Eeuh3Iiax2L3Ow", "https://jazz.ibm.com:9443/rm/resources/BI__yq5tEB6Eeuh3Iiax2L3Ow", "https://jazz.ibm.com:9443/rm/resources/BI__yq5t0B6Eeuh3Iiax2L3Ow", "https://jazz.ibm.com:9443/rm/resources/BI__yq5ukB6Eeuh3Iiax2L3Ow" ]
}, {
"type" : "dng_module:Binding",
"isHeading" : false,
"boundArtifact" : "https://jazz.ibm.com:9443/rm/resources/TX__2GBIkB6Eeuh3Iiax2L3Ow",
"childBindings" : [ ]
}, {
"type" : "dng_module:Binding",
....
API documentation is here https://jazz.net/wiki/bin/view/Main/DNGModuleApiOverview
There's a Python example of accessing the module structure which as a demonstration prints out the indented content and section number in my public OSS package here https://github.com/IBM/ELM-Python-Client/blob/master/elmclient/examples/dn_simple_modulestructure.py
HTH
Ian
S C selected this answer as the correct answer
|
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
Check the URI root. it ends with 'rdm' and not with 'rm' so it is likely not a requirement module and has no module structure.