How to read the NCM Host Configuration from Spectrum using the REST API
search cancel

How to read the NCM Host Configuration from Spectrum using the REST API


Article ID: 115246


Updated On:


CA Spectrum


How to read the Host Configuration from the SpectroSERVER database using the Spectrum REST API. 

The customer was looking to use the Spectrum REST API to read the Host Configuration for a device. 


Use the following URL to read the Host Configuration model for a device:


The model handle in the above URL will be HostConfiguration model associated with the device and the attribute will be (0x822002b).

Once you make the above REST call with the HostConfiguration model handle and 0x82002b attribute the web service will return the response in the below format:


<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model-response-list xmlns="" error="EndOfResults" throttle="1" total-models="1">
<model mh="0x100160">
<attribute id="0x82002b"></attribute>

The XML will need to be parsed to get the attribute value. Once you get the attribute value the following code can be used to get the actual configuration file text:

String contents = new String("");
String dataArray[] = contents.split("\\.");
byte[] bytes = new byte[dataArray.length];
int count = 0;
for(String str : dataArray)
bytes[count++] = Byte.parseByte(str);

System.out.println(new String(bytes));

Note: The actual value of the attribute will be much bigger. Part of the value in the above example has been stripped to keep it short.