Pagination Documentation

Is there no way to paginate with just page size and page number?

On reading the documentation https://developer.okta.com/docs/api/getting_started/design_principles.html#pagination it appears that to paginate I need to know either the last document id from the previous page or the first document id from the next page.

This is really difficult to use as you cannot go to page 6 unless you have been to page 5 or page 7. Please tell me I have missed something.

Here is my powershell example to paginate through users:

$uri = “https://[tenant].okta-emea.com/api/v1//users”

DO

{

$webrequest = Invoke-WebRequest -TimeoutSec 300 -Headers @{“Authorization” = $apiKey} -Method Get -Uri $uri

$link = $webrequest.Headers.Link.Split("<").Split(">")

$uri = $link[3]

$json = $webrequest | ConvertFrom-Json

$allusers += $json

} while ($webrequest.Headers.Link.EndsWith(‘rel=“next”’))

$activeUsers = allusers | Where-Object { _.status -ne “DEPROVISIONED” }

$activeUsers | Sort-Object lastLogin | Select profile, lastLogin | Export-Csv -Path C:\Users.csv -NoTypeInformation