I used the following to retrieve the Module structure:
private JSONArray getModuleStruct() throws Exception {
String structureURI = this.moduleURI + "/structure";
HttpGet get = new HttpGet(structureURI);
get.addHeader("DoorsRP-Request-Type", "public 2.0");
get.addHeader("Accept", "application/json");
HttpResponse response = HttpUtils.sendGetForSecureDocument(clm_props.getServerURL(), get, clm_props.getCLMlogin(), clm_props.getCLMpassword(), httpclient, clm_props.getJazzURL());
if (response.getStatusLine().getStatusCode() != 200) {
response.getEntity().consumeContent();
throw new HttpResponseException(response.getStatusLine()
.getStatusCode(), response.getStatusLine()
.getReasonPhrase());
}
String moduleStr = EntityUtils.toString(response.getEntity());
response.getEntity().consumeContent();
JSONArray jsonArray = new JSONArray(moduleStr);
The new JSONArray(moduleStr); fail because the Strign contains two times the "dng_module:Binding"
[{
"uri": "https://almtest.rtp.raleigh.ibm.com/rm/resources/_a7V9wSiTEei0FZBpM_jKog/structure",
"type": "dng_module:Binding",
"component": "https://almtest.rtp.raleigh.ibm.com/rm/cm/component/_77fFICenEei0FZBpM_jKog",
"type": "dng_module:Binding",
"isStructureRoot": "true",
"module": "https://almtest.rtp.raleigh.ibm.com/rm/resources/_a7V9wSiTEei0FZBpM_jKog",
"boundArtifact": "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil",
"childBindings": ["https://almtest.rtp.raleigh.ibm.com/rm/resources/MB_8bc272efe08d43bab784d0f221390fee", "https://almtest.rtp.raleigh.ibm.com/rm/resources/MB_00d017f1e253498c9b28fc71efc5bc95"]
}, {
Is the issue is the JSONArray too scrict, or the API is generating the extra "type": "dng_module:Binding" by mistake?