How to Update a List/Table attribute using Spectrum REST API?
Spectrum: Any supported version
Below are the syntax for this REST call.
URL
http://<hostname>:<portnumber>/spectrum/restful/model/attr/update
HTTP Method
POST
Body
XML
Body Content
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<update-model-attrlist-request xmlns="http://www.ca.com/spectrum/restful/schema/request">
<model mh="0x100009e"/> <!-- Model Handle -->
<model-attribute-list id="0x12a6d"> <!-- List/Table attribute ID -->
<instance oid="2" value="2"/> <!-- Table row OID and corresponding value -->
<instance oid="3" value="3"/> <!-- Table row OID and corresponding value -->
</model-attribute-list>
</update-model-attrlist-request>
Body Parameters
<model mh="<model_handle>"/>
Specifies the model to update.
<attribute-list id="<attribute_id>">
Specifies the attribute ID to update.
<instance oid="<instance_id_0>" value="<value>"/>
Specifies the instance id and values to update.
Currently is not possible to change List/Table attributes of "Internet Address" type (i.e 0x12d84 - RedundancyPreferredAddress) :
In the example below, we try to change the ip address value in the Instance ID "1" of the attribute to "000.000.000.000", and you will get the following error:
In the Oneclick Tomcat log file, we can see the following:
java.lang.Exception: DefaultSpectrumAttributeConfig.makeCsCValue: Object 000.000.000.000 of class java.lang.String could not be converted for attrID 0x12d84 of type CSC_INTERNET_ADDRESS
at com.aprisma.spectrum.app.web.attribute.DefaultSpectrumAttributeConfig.makeCsCValue(DefaultSpectrumAttributeConfig.java:2000)
at com.aprisma.spectrum.app.web.attribute.DefaultSpectrumAttributeConfig.makeCsCAttrValTable(DefaultSpectrumAttributeConfig.java:2039)
at com.aprisma.spectrum.app.topo.web.repository.ModelRepository.writeAttrTable(ModelRepository.java:6708)
Engineering has debugged the code and identified the root cause of the issue, and it requires a code change to get this fixed. Actually we did not handle the INTERNET ADDRESS type for this attribute value and hence its failing when we pass internet address as a new value.
This is targeted to be fixed post Spectrum 22.2.7 version.
Currently, you can use CLI as a workaround: