14.2. Paginating Events
A storage environment generates a large amount of events after a period of time. However, the API only displays a default number of events for one search query. To display more than the default, the API separates results into pages with the
page
command in a search query.
The following search query tells the API to paginate results using a
page
value in combination with the sortby
clause:
sortby time asc page 1
The
sortby
clause defines the base element to order of the results and whether the results are ascending or descending. For search queries of events
, set the base element to time
and the order to ascending (asc
) so the API displays all events from the creation of your storage environment.
The
page
condition defines the page number. One page equals the default number of events to list. Pagination begins at page 1
. To view more pages, increase the page
value:
sortby time asc page 2
sortby time asc page 3
sortby time asc page 4
Example 14.4. Paginating events
This example paginates
event
resources. The URL-encoded request is:
GET /api/events?search=sortby%20time%20asc%20page%201 HTTP/1.1 Accept: application/xml
Increase the
page
value to view the next page of results.
GET /api/events?search=sortby%20time%20asc%20page%202 HTTP/1.1 Accept: application/xml
Use an additional
from
argument to set the starting id
.
GET /api/events?search=sortby%20time%20asc%20page%202&from=30 HTTP/1.1 Accept: application/xml
22632%2C+Console+Developer+Guide-322-09-2014+17%3A11%3A35Report a bug