The BlueCat Python API is a set of wrapper classes abstracting the functionality of the BlueCat Address Manager API along with certain other BAM and BDDS functions (for example, dynamic updates to host records and remote administration via clish).
The standard usage pattern is to create an API instance, login, retrieve a configuration object, and go from there. For example:
from bluecat.api import API from bluecat.api_exception import APIException try: # Create an API client. api = API('http://10.10.30.42/') # Login using an API user configured via the BAM UI. api.login('my_username', 'my_password') # Obtain a Configuration object. configuration = api.get_configuration('name of my configuration') # For each server in the configuration: for server in configuration.get_servers(): # Print its name and any service IPv4 addresses it has. print(server.name(), server.get_service_ip4_addresses()) except APIException as exc: # Something went wrong. print(exc.get_message())
Here is an example of direct REST API call:
zones = g.user.get_api()._api_client.service.getZonesByHint(view.get_id(), 0, 10, properties)