Skip to content

PKI CLI Paging

Endi S. Dewata edited this page Nov 18, 2021 · 1 revision

Overview

PKI CLI commands that return multiple result entries (e.g. -find commands) may support paging. With paging the results are divided into pages. Each page consists of the same number of entries, except for the last page. The client can specify which page to return using the following parameters:

  • --start: index of the first entry in the page (starting from 0)

  • --size: number of entries in the page

Example

Suppose there are 12 users in the database (e.g. userA, userB, …​, userL). Without paging, the user-find command will return all 12 users. If the page size is set to 5, it will return two pages with 5 entries and one page with 2 entries. A page can be requested by specifying the starting index and the page size. To request the first page:

$ pki user-find --start 0 --size 5
------------------
12 entries matched
------------------
  User ID: userA

  User ID: userB

  User ID: userC

  User ID: userD

  User ID: userE
----------------------------
Number of entries returned 5
----------------------------

To request the second page:

$ pki user-find --start 5 --size 5
------------------
12 entries matched
------------------
  User ID: userF

  User ID: userG

  User ID: userH

  User ID: userI

  User ID: userJ
----------------------------
Number of entries returned 5
----------------------------

To request the third page:

$ pki user-find --start 10 --size 5
------------------
12 entries matched
------------------
  User ID: userK

  User ID: userL
----------------------------
Number of entries returned 2
----------------------------

Note that other command parameters might affect the total number of entries returned. The paging is based on the unpaged command result, not based on the total entries in the database.

For example, a --maxResults 8 limits the maximum number of (unpaged) results to 8, so the second page will only return 3 entries:

$ pki user-find --maxResults 8 --start 5 --size 5
-----------------
8 entries matched
-----------------
  User ID: userF

  User ID: userG

  User ID: userH
----------------------------
Number of entries returned 3
----------------------------
Clone this wiki locally