11-23-2021 01:11 PM
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.
Solved! Go to Solution.
11-24-2021 12:52 AM
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.
11-23-2021 02:49 PM
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": [ ..........
11-23-2021 03:12 PM
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' }
]
11-24-2021 12:52 AM
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.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide