Cisco Prime Infrastructure API
Prime Infrastructure API Documentation

Using Paging

Paging lets you control the number of records returned by a request and page through the results. Check the documentation for each request type to see if it supports Paging.

To page results, use the .maxResults and .firstResult parameters. For example ...

	/webacs/api/v1/data/Devices?.full=true&.firstResult=0&.maxResults=4

would get the first four results (0-3). And ..

	/webacs/api/v1/data/Devices?.full=true&.maxResults=4&.firstResult=4

would get the next four results (4-7).

The response contains information about the full result set and the paging that was used :

              	<queryResponse 
              		last="7" first="4" count="24"
              		type="Devices" 
              		rootUrl="https://ncs-nbi-demo-1/webacs/api/v1/data" 
              		requestUrl="https://ncs-nbi-demo-1/webacs/api/v1/data/Devices?.full=true&.maxResults=4amp;.first=4" 
              		responseType="listEntityInstances">
              		....
              	

One can also use a HTTP header to control the paging. The Range header using a type of 'instances' can be added to a request instead of using the query parameters.

For example, this header would get the first 4 results:

				Range:instances=0-3
				

The request/response for this would be:

> GET /model/data/Equipment HTTP/1.1
> User-Agent: curl/7.28.1
> Host: localhost:9000
> Accept: */*
> Range:instances=0-3
> 
< HTTP/1.1 200 OK
< Content-Type: text/xml
< Content-Range: instances 0-3/14
< Content-Length: 607
< 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<queryResponse last="3" first="0" count="14" responseType="listEntityIds" 
    requestUrl="http://localhost:9000/model/data/Equipment" 
    rootUrl="http://localhost:9000/model/data" type="Equipment"> 
    ....             	
              	

Note: The url parameters .firstResult and .maxResults will override the header range value