users

The following methods allow for interaction with the ZDX Users API endpoints.

Methods are accessible via zdx.users

Copyright (c) 2023, Zscaler Inc.

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED “AS IS” AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

class UsersAPI

Bases: APIClient

get_user(user_id, query_params=None)

Returns information on the specified user configured within the ZDX tenant.

Parameters:

user_id (str) – The unique ID for the ZDX user.

Keyword Arguments:
  • since (int) – The number of hours to look back for devices.

  • location_id (str) – The unique ID for the location.

  • department_id (str) – The unique ID for the department.

  • geo_id (str) – The unique ID for the geolocation.

Returns:

The user information.

Return type:

Tuple

Examples

Return information on the user with the ID of 999999999:

>>> user_details, _, err = client.zdx.users.get_user('24328827')
... if err:
...     print(f"Error listing user details: {err}")
...     return
... for user in user_details:
...     print(user)
list_users(query_params=None)

Returns a list of all active users configured within the ZDX tenant.

Keyword Args: :keyword query_params {dict}: Map of query parameters for the request.

[query_params.since] {int}: The number of hours to look back for devices.

[query_params.location_id] {list}: The unique ID for the location. You can add multiple location IDs.

[query_params.exclude_loc] {list}: The location IDs. You can exclude multiple location IDs.

[query_params.department_id] {list}: The unique ID for the department. You can add multiple location IDs.

[query_params.exclude_dept] {list}: The department IDs. You can exclude multiple department IDs.

[query_params.geo_id] {list}: The unique ID for the geolocation. You can add multiple location IDs.

[query_params.offset] {str}: The next_offset value from the last request.

You must enter this value to get the next batch from the list. When the next_offset value becomes null, the list is complete.

[query_params.limit] {int}: The number of items that must be returned per request from the list.

Minimum: 1

Returns:

The list of users in ZDX.

Return type:

Tuple

Examples

List all users in ZDX for the past 2 hours:

>>> user_list, _, err = client.zdx.users.list_users()
... if err:
...     print(f"Error listing users: {err}")
...     return
... for user in user_list:
...     print(user)

List all users in ZDX for the past 2 hours:

>>> user_list, _, err = client.zdx.users.list_users(query_params={"since": 2})
... if err:
...     print(f"Error listing users: {err}")
...     return
... for user in user_list:
...     print(user)