cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
969
Views
1
Helpful
3
Replies

Retrieving group members not working over 100

Ruben_Cardenal
Level 1
Level 1

Hello,

Let’s take this:

> client.jsonApiCall('GET', '/admin/v2/groups/XXXXXXXXXXXXXXXX/users', { limit: 200 }, console.log);
undefined
> {
  metadata: { total_objects: 101 },
  response: [
    { user_id: '--------', username: 'xxxx_001' },
    . . . .
    { user_id: '--------', username: 'xxxx_099' },
    { user_id: '--------', username: 'xxxx_100' },
    ... 1 more item

But I specified “200” as limit, because in principle we won’t have more than 200 users, so I don’t have to deal with pagination.

Is this normal behaviour? I mean, even when setting 200 as limit, it’s only showing 100. Doesn’t matter if I do

limit: 200

or

limit: “200”

The group has 101 users.

Thanks.

1 Accepted Solution

Accepted Solutions

Hello,

Thanks for pointing in the right direction. Actually what’s needed for this case is:

const util = require('util')
util.inspect.defaultOptions.maxArrayLength = null

Regards.

View solution in original post

3 Replies 3

DuoKristina
Cisco Employee
Cisco Employee

I have zero node experience so I can’t speak to the nodejs client specifically, but yes that is how limit should work in the api request/response and I’d think you would add {limit:200}.

I have the python client working and checked it there with a group of 125 users and it increased the page…

w/o specifying a value for limit:

python -m duo_client.client --ikey nnn --skey nnn --host nnn --path /admin/v2/groups/the_group_id/users --method GET

200 OK
{
    "metadata": {
        "next_offset": 100, 
        "total_objects": 125
    }, 
    "response": [  ............

with a value for limit ( both > 100 and > the # of group members):

python -m duo_client.client --ikey nnn --skey nnn --host nnn --path /admin/v2/groups/the_group_id/users limit=110 --method GET

200 OK
{
    "metadata": {
        "next_offset": 110, 
        "total_objects": 125
    }, 
    "response": [ ..........

python -m duo_client.client --ikey nnn --skey nnn --host nnn --path /admin/v2/groups/the_group_id/users limit=200 --method GET

200 OK
{
    "metadata": {
        "total_objects": 125
    }, 
    "response": [ ..........
Duo, not DUO.

Might you be running into maxArrayLength? I see that defaults to 100.

ETA: yes, when I set the maxArrayLength to null my output from the get on the group of 125 users with limit:200 went from:

...99 preceding lines of users...
{ user_id: 'DUblahblah', username: 'someuser' },
  ... 25 more items
]

to

...124 preceding lines of users...
  { user_id: 'DUnewblahblah', username: 'someotheruser' }
]
Duo, not DUO.

Hello,

Thanks for pointing in the right direction. Actually what’s needed for this case is:

const util = require('util')
util.inspect.defaultOptions.maxArrayLength = null

Regards.

Quick Links