Okta.Sdk UsersList / User missing next link access and missing next link from response

When getting user via okaClient.UserList, I don’t see a way to get the next link from the API. I also don’t see the _next link when issuing a Rest call from postman.

c# code. I don’t see a way to find the links. FYI - i’m returning the data and storing it in a general IUser in our system not the same as your IUser

 var oktaUsers = _provider.OktaClient.Users.ListUsers(query,after, limit, filter, format, search, expand);
            
            var list = new List<IUser>();


            await oktaUsers.ForEachAsync(u =>
                {
                    list.Add(new User() { Id = u.Id, FirstName = u.Profile.FirstName, LastName = u.Profile.LastName, Email = u.Profile.Email, Login = u.Profile.Login });                    
                }

             );

Postman response (sensitive data xxx’d out) and response shorten for brevity

"_links": {
            "self": {
                "href": "https://dev-xxxxx.oktapreview.com/api/v1/users/xxxxx"
            }
        }

It should be in the link header:
https://developer.okta.com/docs/api/getting_started/design_principles#link-header

Thanks! I found it in the headers (in postman). Is there a way to access it from the Okta.Sdk when pulling back a list of users or do I need to manage/create my own request and parse it that way?

@nate.barbettini do you happen to know?

Hey @EricWilson! The SDK doesn’t currently expose the headers, but see this Github issue (and the linked PR) for how we might make this possible soon: https://github.com/okta/okta-sdk-dotnet/issues/222

What do you need to do in your code with the next link? If you just need to run some code on each user, this should be sufficient:

await client.Users.ForEachAsync(user =>
{
    // do something with each user
});

@nate.barbettini, thanks. I’m currently doing something similar, however the next link would be needed in cases where I don’t get all the users back in one call. This would allow me to page to the next set. Our UI, will talk to the Okta backend to pull users into our system. We’re managing the users authorization within the system itself (vs. authorization / claims stored in Okta). I’m guessing that the 200 limit (or increasing the request size) will work fine, but I’m trying cover all the bases. As a side note, ideally we’d like to pull / query users by Organizations (loaded into groups). I know I can pull the users from a particular group but I can’t add search/filter patterns on the users - this is a side note and I have another ticket on that issue.

Just so I understand your system: do you want your UI to only show a page at a time (and pass that paging position over to Okta), or show all users at once?

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.