Cloudera Navigator API fail to fetch nested data

435 views Asked by At

I am working in Cloudera Manager Navigator REST API where extracting result is working fine, but unable to get any nested value.

The type of data is extracting as below.

{
    "parentPath": "String",
    "customProperties": "Map[string,string]",
    "sourceType": "String",
    "entityType": "String"
}

And data should be like

{
    "parentPath": "abcd",
    "customProperties": {
                            "nameservice" : "xyz"
                        },
    "sourceType": "rcs",
    "entityType": "ufo"
}

But I am getting key-value result as follows.

parentPath :abcd
customProperties : null
sourceType : rcs
entityType : ufo

In above response data, "customProperties" is coming with a null value where it should return a map object contains ["nameservice" : "xyz"]. This is the problem with following code snippet.

MetadataResultSet metadataResultSet = extractor.extractMetadata(null, null,"sourceType:HDFS", "identity:*");
Iterator<Map<String, Object>> entitiesIt = metadataResultSet.getEntities().iterator(); 
     while(entitiesIt.hasNext()){
        Map<String, Object> result = entitiesIt.next();
        for(String data : result.keySet()){
                        System.out.println(" key:"+data+" value:"+result.get(data));
                        }
        }

Can you suggest me how to get the nested value where datatype is complex.

1

There are 1 answers

1
Manohar CS On

have u checked how the data looks on navigator ui? You can first verify that once, and also try cloudera /entities/entity-id rest API in browser to check how json response is coming