How to get more than 100 results from a Box API
I am using the Box API in POSTMAN to get all of the users in our Enterprise.
We have nearly 1000 users but I can only see the first 100 when I send the call in Postman.
I know more can be displayed or see more in an offset. I have done it before at BoxWorks 2016. However, for the life of me, I cannot remember how to do it. Nor can I find it in the Box Developers documentation.
Here is what I am sending in Postman: https://api.box.com/2.0/users/?fields=name,login,id
but I want to get more than 100 results back from this API call.
I know it is simple but can someone point me in the right direction.
Thank you for your help.
Brett Watts
-
You can use the offset parameter to iterate through your list of users. I'll walk through an example below.
As you mentioned in your post, here is the first API call, which will return the first 100 users.
curl "https://api.box.com/2.0/users?fields=name,login,id"
-H "Authorization: Bearer ACCESS_TOKEN"For the second API calls, you will set offset=100, which let you get the next set of 100 users.
curl "https://api.box.com/2.0/users?fields=name,login,id&offset=100"
-H "Authorization: Bearer ACCESS_TOKEN"For subsequent API calls, you will continue to increment offset by 100 to get all the users in your enterprise.
curl "https://api.box.com/2.0/users?fields=name,login,id&offset=200"
-H "Authorization: Bearer ACCESS_TOKEN"
Please sign in to leave a comment.
Comments
1 comment