custom_apps

The following methods allow for interaction with the ZBI Custom Applications API endpoints.

Methods are accessible via zbi.custom_apps

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 CustomAppsAPI

Bases: APIClient

A Client object for the Business Insights Custom Applications resource.

Provides CRUD operations for managing custom applications used to track specific web traffic in Zscaler Business Insights.

create_custom_app(**kwargs)

Creates a custom application.

Parameters:
  • name (str) – The custom application name. Must be unique, max 128 characters.

  • description (str) – Description of the custom application. Max 1024 characters.

  • signatures (list) – List of signature dicts, each with type, matchLevel, and value keys.

Returns:

(CustomApp instance, Response, error).

Return type:

tuple

Examples

Create a custom app:

>>> app, _, err = client.zbi.custom_apps.create_custom_app(
...     name="My App",
...     description="Tracks traffic",
...     signatures=[
...         {"type": "HOST", "matchLevel": "EXACT",
...          "value": "example.com"}
...     ]
... )
>>> if err:
...     print(f"Error: {err}")
>>> print(app.as_dict())
delete_custom_app(app_id)

Deletes a custom application by ID.

Parameters:

app_id (int) – The unique identifier of the custom application to delete.

Returns:

(status_code, Response, error).

Return type:

tuple

Examples

Delete a custom app:

>>> _, _, err = client.zbi.custom_apps.delete_custom_app(101)
>>> if err:
...     print(f"Error: {err}")
get_custom_app(app_id)

Retrieves a specific custom application by ID.

Parameters:

app_id (int) – The unique identifier of the custom application.

Returns:

(CustomApp instance, Response, error).

Return type:

tuple

Examples

Get a custom app by ID:

>>> app, _, err = client.zbi.custom_apps.get_custom_app(101)
>>> if err:
...     print(f"Error: {err}")
>>> print(app.as_dict())
list_custom_apps(query_params=None)

Retrieves all custom applications.

Parameters:

query_params (dict, optional) –

Map of query parameters.

[query_params.id] (int): Optional Custom App ID to retrieve a specific app.

Returns:

(list of CustomApp instances, Response, error).

Return type:

tuple

Examples

List all custom apps:

>>> apps, _, err = client.zbi.custom_apps.list_custom_apps()
>>> if err:
...     print(f"Error: {err}")
>>> for app in apps:
...     print(app.as_dict())

Client-side filtering with JMESPath:

The response object supports client-side filtering and projection via resp.search(expression). See the JMESPath documentation for expression syntax.

update_custom_app(app_id, **kwargs)

Updates a custom application by ID.

Parameters:
  • app_id (int) – The unique identifier of the custom application.

  • name (str) – Updated name.

  • description (str) – Updated description.

  • signatures (list) – Updated list of signature dicts.

Returns:

(CustomApp instance, Response, error).

Return type:

tuple

Examples

Update a custom app:

>>> app, _, err = client.zbi.custom_apps.update_custom_app(
...     101,
...     name="Updated App",
...     description="Updated description",
...     signatures=[
...         {"type": "HOST", "matchLevel": "EXACT",
...          "value": "updated.com"}
...     ]
... )