DX NetOps

 View Only

Web Service API Request when attribute value pairs are specified

  • 1.  Web Service API Request when attribute value pairs are specified

    Posted May 08, 2019 09:53 AM

    Hi,

    When I generate a request to the OneClick server and pass the attribute 0x11f56

     

    0x11f56 | Severity | Integer

     

    http://10.135.96.121:8080/spectrum/restful/alarms?attr=0x11f56

     

    The answer is all alarm id and respective severity

     

    <alarm-response-list xmlns="http://www.ca.com/spectrum/restful/schema/response" total-alarms="8155" throttle="1000">
    <alarm-responses>
    <alarm id="5cc82a3e-1791-1006-014c-0080108760a2">
    <attribute id="0x11f56">1</attribute>
    </alarm>
    <alarm id="5cc82a43-17a4-1006-014c-0080108760a2">
    <attribute id="0x11f56">3</attribute>
    </alarm>
    <alarm id="5cd006a1-8f3e-1020-0374-0080108760a2">
    <attribute id="0x11f56">2</attribute>
    </alarm>
    <alarm id="5cc82931-88bb-1004-014c-0080108760a2">
    <attribute id="0x11f56">2</attribute>
    </alarm>
    <alarm id="5cc82905-cb7d-1002-014c-0080108760a2">
    <attribute id="0x11f56">1</attribute>
    </alarm>
    <alarm id="5cc8292c-03ca-1004-014c-0080108760a2">
    <attribute id="0x11f56">2</attribute>
    </alarm>
    <alarm id="5cd0069d-8f30-1020-0374-0080108760a2">
    <attribute id="0x11f56">0</attribute>
    </alarm>
    <alarm id="5cc82905-cbce-1002-014c-0080108760a2">
    <attribute id="0x11f56">1</attribute>
    </alarm>
    <--------- removed ------->

     

    In documentation and for what I understand, if we use the pair <attribute|value>:

     

    https://docops.ca.com/ca-spectrum/10-0/en/programming/web-services-api-reference/how-to-use-the-ca-spectrum-web-services-api/requests

     

    &attr=<attr_ID>&val=<num>
    Specifies attribute value pairs, which are used to obtain specific attribute values for the resource being queried. For example, if you GET alarms, you get the alarm IDs only by default. However, if you retrieve alarms with specified attributes you get the alarm IDs with their specific attribute values.
    When attribute value pairs are specified, especially when updating attribute values, attribute ID and values must occur in sequence for proper binding of the ID and value, as in the following:

    ?attr=0x10062&val=text&attr=0x10001&val=12334

    This pairing tells the RESTful servlet that an attr ID will be followed by the desired value for that ID when updating the value of the attribute.
    Multiple attribute-value pairs can be specified.

    I hoped that if we placed in the url the att 0x11f56 and the value 1:

     

    http://10.135.96.121:8080/spectrum/restful/alarms?attr=0x11f56&val=1

     

    the answer was only the alarms whose severity was 1. But no, it returns all alarms with various severities:

     

    <alarm-response-list xmlns="http://www.ca.com/spectrum/restful/schema/response" total-alarms="8152" throttle="1000">
    <alarm-responses>
    <alarm id="5cc82a3e-1791-1006-014c-0080108760a2">
    <attribute id="0x11f56">1</attribute>
    </alarm>
    <alarm id="5cc82a43-17a4-1006-014c-0080108760a2">
    <attribute id="0x11f56">3</attribute>
    </alarm>
    <alarm id="5cd006a1-8f3e-1020-0374-0080108760a2">
    <attribute id="0x11f56">2</attribute>
    </alarm>
    <alarm id="5cc82931-88bb-1004-014c-0080108760a2">
    <attribute id="0x11f56">2</attribute>
    </alarm>
    <alarm id="5cc82905-cb7d-1002-014c-0080108760a2">
    <attribute id="0x11f56">1</attribute>
    </alarm>
    <alarm id="5cc8292c-03ca-1004-014c-0080108760a2">
    <attribute id="0x11f56">2</attribute>
    </alarm>
    <alarm id="5cd0069d-8f30-1020-0374-0080108760a2">
    <attribute id="0x11f56">0</attribute>
    </alarm>
    <alarm id="5cc82905-cbce-1002-014c-0080108760a2">
    <attribute id="0x11f56">1</attribute>
    </alarm>
    <alarm id="5ccaaa9b-ca9b-100b-0374-0080108760a2">
    <attribute id="0x11f56">0</attribute>
    </alarm>

     

    BR


    David