S.H.
S.H.

Reputation: 13

Okta API returning an incomplete list of users and applications

I'm trying to fetch a list of all applications on Okta, and a list of the users using each application.

However, sending a GET request to /api/v1/apps is resulting in an incomplete list of applications, and following a link to the users of each app is also incomplete.

Am I calling incorrectly? Or is there some reason that specific apps/users would not show up in the list?

Any help is appreciated.

EDIT: I am setting limit=10000 and still am missing users.

Upvotes: 1

Views: 1908

Answers (2)

Helmut
Helmut

Reputation: 21

I use the limit and after parameter. Here is an example (in my code I increment my counter by the limit value)

{{url}}/api/v1/users?search=status eq "ACTIVE"and lastUpdated gt "2017-04-26T04:00:00.000Z" and created lt "2017-04-26T04:00:00.000Z" &limit=200&after=1400

This query will return any users that meet the criteria and are after 1400. In other words if I have 1500 users it will return the users 1401 to 1500.

Upvotes: 0

Joël Franusic
Joël Franusic

Reputation: 1188

When a response exceeds the the maximum number of results, the results are paginated and a Link header is added to the results.

For example:

HTTP/1.1 200 OK
Link: <https://yoursubdomain.okta.com/api/v1/users?after=00ubfjQEMYBLRUWIEDKK>; rel="next"  <https://yoursubdomain.okta.com/api/v1/users?after=00ub4tTFYKXCCZJSGFKM>; rel="self"

Note: It is important to follow these Link header values instead of constructing your own URLs as query parameters or cursor formats may change without notice.

See the Okta documentation for pagination for more information.

Upvotes: 1

Related Questions