In CA Spectrum REST API Call, Post method of get Models, an Invalid attribute ID error is thrown

book

Article ID: 4870

calendar_today

Updated On:

Products

CA Spectrum

Issue/Introduction

An Invalid attribute ID error is thrown when a REST Call, Post method of get Models, is made if the body contains attribute ID:

AttributeID.MODEL_NAME

Cause

The REST call requires the Hex value of the AttributeID.MODEL_NAME to work, not the actual (string) name of the model.

Environment

Spectrum 10.x

Resolution

Pass the Hex value of AttributeID.MODEL_NAME, instead of String. In the PayLoad of the RestAPI for the post call, to fetch the alarms along with Spectrum attributes we must use hex values instead of Strings. For Ex:
Below is the payload

<rs:alarm-request xmlns:rs="http://www.ca.com/spectrum/restful/schema/request" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" throttlesize="1000" xsi:schemaLocation="http://www.ca.com/spectrum/restful/schema/request ../../../xsd/Request.xsd ">
<rs:attribute-filter>
<search-criteria xmlns="http://www.ca.com/spectrum/restful/schema/filter">
<filtered-models>
<or>
<equals>
<attribute id="0x11f56">

<value>3</value>

</attribute>
</equals>
<equals>
<attribute id="0x11f56">

<value>2</value>

</attribute>
</equals>
<equals>
<attribute id="0x11f56">

<value>1</value>

</attribute>
</equals>
</or>
</filtered-models>
</search-criteria>
</rs:attribute-filter>

The following are the requested Spectrum attributes with each alarm 

<rs:requested-attribute id="0x12b4c"/>
<!--  Alarm Title  -->
<rs:requested-attribute id="0x11f56"/>
<!--  Alarm Severity  -->
<rs:requested-attribute id="0x11f52"/>
<rs:requested-attribute id="0x129ac"/> 
</rs:alarm-request>

In this case, for the requested attributes tag, always the hex value is expected instead of AttributeID.MODEL_NAME