Reputation: 498
box-python-sdk methods 'Get Enterprise users' and 'Get Group' supports 'Offset-based Paging', according to api docs they should return total_count, limit, offset
fields that can be used for next request/pagination.
# sdk method to get enterprise users
users = client.users(limit=1000, offset=0, filter_term=None, user_type=None, fields=fields)
print(vars(users))
#output
{'_session': <boxsdk.session.session.AuthorizedSession object at 0x7f3382a6b400>,
'_url': 'https://api.box.com/2.0/users', '_limit': 1000,
'_fields': ['type', 'id', 'name', 'login', 'created_at', 'modified_at',
'language', 'timezone', 'space_amount', 'space_used', 'max_upload_size',
'status', 'job_title', 'phone', 'address', 'avatar_url', 'role',
'tracking_codes', 'can_see_managed_users', 'is_sync_enabled',
'is_external_collab_restricted', 'is_exempt_from_device_limits',
'is_exempt_from_login_verification', 'enterprise', 'my_tags', 'hostname',
'is_platform_access_only'],
'_additional_params': {'user_type': 'managed'},
'_return_full_pages': False,
'_has_retrieved_all_items': False,
'_all_items': None,
'_offset': 0}
It doesn't return total_count
and same goes for method client.get_groups()
.
I have doubled checked box-api
is returning total_count
. am i making some mistake or there is a bug in sdk.
Upvotes: 0
Views: 400
Reputation: 498
I got answer of this question on github. If anyone else come here googling, I'm posting this for them.
Unfortunately the total_count field is not exposed with the iterator. However, you can get back the total_count if you make a manual call as that returns a JSON object.
Something like this:
client.make_request('GET', 'https://api.box.com/2.0/users')
.
For more details click
Upvotes: 3