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

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?

0 votes

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.


Accepted answer

Permanent link
Hi

For the module structure API it's important to:
  • Don't construct the structure URL, get it from the module definition by doing a GET on the module URL using the following settings:
  • Provide header (capitalised exactly like this)
    • DoorsRP-Request-Type: public 2.0
  • Do NOT provide header OSLC-Core-Version
  • Provide the configuration using header vvc.configuration and NOT using header Configuration-Context or query ?oslc_config.context - so it must be a local configuration URL not a global configuration
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:oslc_core="http://open-services.net/ns/core#"
    xmlns:oslc_config="http://open-services.net/ns/config#"
    xmlns:jazz_rm="http://jazz.net/ns/rm#"
    xmlns:rm_types="http://www.ibm.com/xmlns/rdm/types/"
    xmlns:process="http://jazz.net/ns/process#">
    <j.0:childBindings rdf:parseType="Collection">
        <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:childBindings rdf:parseType="Collection">
            <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: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,
}, {
  "type" : "dng_module:Binding",
  "isHeading" : true,
}, {
  "type" : "dng_module:Binding",
  "isHeading" : false,
  "childBindings" : [ ]
}, {
  "type" : "dng_module:Binding",
  ....


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

0 votes

Comments

Thank you Ian. I was able to get module structure from DNG. 

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
× 12,014

Question asked: Nov 29 '21, 4:13 a.m.

Question was seen: 1,342 times

Last updated: Dec 16 '21, 7:09 a.m.

Confirmation Cancel Confirm