CA Spectrum - Getting the alarms count via the REST API using Subscription ID

Document ID : KB000076433
Last Modified Date : 13/09/2018
Show Technical Document Details
Introduction:
The Spectrum REST API allows a number of functions to be accessed. One of these is to get the Alarm count in Spectrum.
Question:
How can the alarm count be obtained via a Subscription ID using a POST call in CA Spectrum using REST API?
Environment:
Spectrum version 10.x.x
All Platforms
Answer:
For Subscription model, please follow  below steps 
  1. Get the Subscription ID by using the URL;
  • Example for Pull Alarms Subscription request available under $SPECROOT/RestfulExamples/xml/Alarms/PullAlarmsSubscription.xml
  • Add the following attribute to the request to get existing alarms in the first request;
send-preexisting-instances="true"
<rs:subscription-request 
  xmlns:rs="http://www.ca.com/spectrum/restful/schema/request" send-preexisting-instances="true"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.ca.com/spectrum/restful/schema/request ../../../Rest.a/src/xsd/Request.xsd ">

  ---------
  -------- 
  • Set the pull-interval value as per desired requirement. For example;
<rs:pull-interval>30000</rs:pull-interval>
  1. Now, get the new alarms using the Subscription ID via the following URL;
http://<ONECLICK_HOST><:portnumber>/spectrum/restful/subscription/<subscription_ID>

 
Additional Information:
The Spectrum 10.2.x docops guide describes this further:

https://docops.ca.com/ca-spectrum/10-2-3/en/programming/web-services-api-reference/how-to-use-the-ca-spectrum-web-services-api/restful-resources-nouns/subscription#subscription-GETSubscription