BlueCat Python API documentation - Platform - BlueCat Gateway - 19.8.1

Gateway Administration Guide

Locale
English (United States)
Product name
BlueCat Gateway
Version
19.8.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:

#!/usr/bin/python
from bluecat import api, api_exception

try:

    # Create a connection - the URL is the same one as used for raw BAM REST API.
    conn = API('http://192.168.56.191/Services/REST/application.wadl')

    # Login using an API user configured via the BAM UI.
    conn.login('admin', 'admin')

    c = conn.get_configuration('Configuration Name')
    for s in c.get_servers():

        # Print the server name and any service IP4 addresses it has.
        print (s.name(), s.get_service_ip4_addresses())

except APIException as e:
    # Something went wrong.
    print (e.get_message())
The various classes and modules that form part of the Python API are listed in the Module Index.
Note: All REST API calls can be used 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.