Docs
Live demo

Read a whole list through the API

Page through an API list via next_cursor until has_more is false.

Before you start: read API token, curl, jq.

  1. Request page one with limit, e.g. GET /identities?kind=user&limit=100.
  2. While has_more is true, pass cursor set to next_cursor unchanged.
  3. Stop when has_more is false.
bash
cursor=""
url="$PRINCIPAL_URL/api/v2/identities?kind=user&limit=100"
while true; do
  page=$(curl -s -H "Authorization: Bearer $PRINCIPAL_TOKEN" \
    "${url}${cursor:+&cursor=$cursor}")
  echo "$page" | jq -r '.items[].display_name'
  [ "$(echo "$page" | jq -r '.has_more')" = "true" ] || break
  cursor=$(echo "$page" | jq -r '.next_cursor')
done
↑ ↓ to moveEnter to openEsc to close