CA Spectrum - Rest API - getting old alarms during poll

Document ID : KB000076431
Last Modified Date : 13/04/2018
Show Technical Document Details
Question:
In CA Spectrum how to get only new alarms using REST API?
Environment:
Spectrum version 10.x.x.
Answer:
1. Get the Subscription ID with filter and attribute list as part of subscription request, 

URL: http://<hostname><:portnumber>/spectrum/restful/subscription 

2. Make sure filter attribute also added including filter as below as part of request 

<rs:requested-attribute id="0x12a07" /> <!-- Cause Count --> 

3. Same Subscription should be added for future/next calls 

4. Attached tested xml file PullAlarmsSubscription.xml to case for reference 

<rs:alarm-request> 

<rs:attribute-filter> 
<search-criteria xmlns="http://www.ca.com/spectrum/restful/schema/filter"> 
<filtered-models> 
<equals> 
<attribute id="0x12a07"> 
<value>0</value> 
</attribute> 
</equals> 
</filtered-models> 
</search-criteria> 
</rs:attribute-filter> 

<rs:requested-attribute id="0x1006e" /> <!-- Model Name --> 
<rs:requested-attribute id="0x11f53" /> <!-- Model Handle --> 
<rs:requested-attribute id="0x11f56" /> <!-- Alarm Severity --> 
<rs:requested-attribute id="0x11f4e" /> <!-- Alarm Creation Date --> 
<rs:requested-attribute id="0x12b4c" /> <!-- Alarm Title --> 
<rs:requested-attribute id="0x1296e" /> <!-- Originating Event text --> 
<rs:requested-attribute id="0x12a07" /> <!-- Cause Count --> 
</rs:alarm-request> 

This is the Expected Output: 
-------------------- 
<added-instance preexisting="false"> 
<alarm id="5abfb429-f73c-1003-013e-0050568c7c38"> 
<attribute id="0x10000">Rtr_Cisco</attribute> 
<attribute id="0x12a07">0</attribute> 
<attribute id="0x11f56">3</attribute> 
<attribute id="0x12b4c">CHASSIS DOWN</attribute> 
<attribute id="0x11f9c">5abfb429-f73c-1003-013e-0050568c7c38</attribute> 
<attribute id="0x12a1f"></attribute> 
<attribute id="0x12d7f">38.42.96.11</attribute> 
<attribute id="0x1006e">cis7505-xx.xxxx.ca.com</attribute> 
<attribute id="0x11f4e">1522512937</attribute> 
<attribute id="0x1296e">The chassis cis7505-xx.xxxx.ca.com and all of its contained blades have stopped responding to polls and/or external requests. Additionally, all devices upstream from them can be contacted implying a chassis fault. A 'Chassis Down' alarm will be generated.</attribute> 
</alarm> 
</added-instance> 

Verify cause code attribute value, it should be zero ("0") as below, otherwise filter is not working. 
<attribute id="0x12a07">0</attribute> 

Please confirm, this can be easily tested from Browser (Postman - REST client) 

Please Note: Same Subscription ID should be used for all future/next REST GET calls as below 

http://<hostnumber><:portnumber>/spectrum/restful/subscription/<subscription_ID> 


pull-interval value in the request can be updated based on your requirement, this is basically "Subscription ID" expiration time in milliseconds. 
<rs:pull-interval>30000</rs:pull-interval> 

 Note: Same Subscription ID should be used for all future/next REST GET calls as below

http://<hostnumber><:portnumber>/spectrum/restful/subscription/<subscription_ID>