Using Throttle and Next

This example uses GET alarms to retrieve all alarms and shows how the throttle and "next" link are used.
casp102
This example uses GET alarms to retrieve all alarms and shows how the throttle and "next" link are used.
Follow these steps:
  1. Use the following request, which asks for all alarms to be returned but only three at a time:
    http://comp001/spectrum/restful/alarms?throttlesize=3
    Notice the following in this request:
    • throttlesize
      Indicates the number of items to return at a time. This example requests three alarms to be returned at a time.
    The following response returns from the
    SpectroSERVER
    . This response indicates that a total of five alarms exist and only three are returned. A relative link is provided that points to the next items in the list.
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> - <alarm-response-list xmlns="http://www.ca.com/spectrum/restful/schema/response" throttle="3" total-alarms="5"> - <alarm-responses> <alarm id="4e77f4fd-1c9b-1000-0336-000874f00c29" /> <alarm id="4e77f4fe-1ca2-1000-0336-000874f00c29" /> <alarm id="4e80da2b-a48e-1001-0336-000874f00c29" /> </alarm-responses> <link rel="next" href="http://comp001/spectrum/restful/alarms?id=c6a367df-0b3e-4461-aa8d- aad451a45bf7&start=3&throttlesize=3" type="application/xml" /> </alarm-response-list>
    Notice the following in this response:
    • throttle
      Indicates the number of items returned in this response. In this example, three alarms have been returned in this response.
    • total-alarms
      Indicates the total number of items in the result set. In this example, there a five total alarms in the result set.
    • link rel="next"
      Indicates the URL to retrieve the next items in the result set. This link can be used in a browser or a program to issue the next request.
      • id=<
        result_set_ID
        >
        Specifies the location of the result set on the OneClick server. The data expires after ten minutes of inactivity.
      • start=<
        element_num
        >
        Indicates the position within the result set.
  2. Use the "next" relative link from the previous response to request the next three items in the result set:
    http://comp001/spectrum/restful/alarms?id=c6a367df-0b3e-4461-aa8d- aad451a45bf7&start=3&throttlesize=3
    The following response returns from the
    SpectroSERVER
    :
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> - <alarm-response-list xmlns="http://www.ca.com/spectrum/restful/schema/response" error="EndOfResults" throttle="2" total-alarms="5"> - <alarm-responses> <alarm id="4e83d694-18e1-1002-0336-000874f00c29" /> <alarm id="4e77f4fe-1c9e-1000-0336-000874f00c29" /> </alarm-responses> </alarm-response-list>
    Notice the following in this response:
    error="EndOfResults"
    Indicates that all items in the list have been retrieved.