<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content

Retrieve Okta Advanced Server Access Users With Pagination via the API

Advanced Server Access
Okta Classic Engine
Okta Identity Engine

Overview

Retrieve Okta Advanced Server Access (ASA) users with pagination through the Application Programming Interface (API) by creating a service user, generating an API key, and executing a series of curl commands.

Applies To

  • Okta Identity Engine (OIE)
  • Okta Classic Engine
  • Okta Advanced Server Access (ASA)
  • Application Programming Interface (API)

Solution

How are Okta Advanced Server Access users retrieved with pagination via the API?

Create a service user, generate an API key, and execute the required API requests to retrieve the paginated user list by following these steps:

  1. Create a service user and assign it to an admin group.
  2. Create an API key for the service user and record the key and secret for use in the subsequent steps.
  3. Update the <asa-team>, <key>, and <secret> values in the following command and execute it:
    curl -v -H "Content-Type: application/json" -X POST "https://app.scaleft.com/v1/teams/<asa-team>/service_token" -d '{ "key_id": "<key>", "key_secret": "<secret>" }'
  1. Copy the bearer_token value from the output and use it as the <token> in the following command:
    curl -i -s GET "https://app.scaleft.com/v1/teams/<asa-team>/users?count=100" --header 'Accept: application/json' --header 'Content-Type: application/json' --header 'Authorization: Bearer <token>'
  1. Review the returned values and locate the link header showing a URL with an offset username value, similar to the following example:
    link: <https://app.scaleft.com/v1/teams/<asa-team>/users?count=100&descending=true&offset=<user_name>>; rel="prev"
  1. Insert the offset value from step 5 into the command from step 4 and execute it again. The updated request appears as follows:
    curl -i -s GET "https://app.scaleft.com/v1/teams/<asa-team>/users?count=100&offset=<user_name>" --header 'Accept: application/json' --header 'Content-Type: application/json' --header 'Authorization: Bearer <token>'
  1. Repeat steps 5 and 6 to retrieve the complete user list.
Loading
Retrieve Okta Advanced Server Access Users With Pagination via the API | Okta Support