BlueCat Address Manager Python API - Platform - BlueCat Gateway - 20.12.1

Gateway Administration Guide

prodname
BlueCat Gateway
version_custom
20.12.1

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())
The Module Index lists the various classes and modules that form part of the Python API.
Note: You can use all REST API calls directly as well, bypassing the wrappers.

Here is an example of direct REST API call:

zones = g.user.get_api()._api_client.service.getZonesByHint(view.get_id(), 0, 10, properties)
Note: For complete code samples for API refer to the BlueCat Gateway WebHelp and Documentation.