Accessing GraphQL with BlueCat Python Library code - BlueCat Python Library - 22.4.1

BlueCat Python Library Guide

Product name
BlueCat Python Library

The 22.4.1 release of Gateway includes a new experimental GraphQL API Client. Harness the power and flexibility of GraphQL to fetch BlueCat Address Manager data simply and efficiently. You can access the GraphQL API Client through the BlueCat Python Library.

Gateway GraphQL functionality is not intended or planned for large data set retrieval. It is meant to improve efficiency in the retrieval of small but relevant data when needed.

Documentation for supported GraphQL interfaces can be found in BlueCat Address Manager on the Administration tab, in GraphQL API Lab section.

To access Gateway's GraphQL API Client from the BlueCat Python Library, use the following call:

import json
from bluecat_libraries.address_manager._graphql import Client

with Client("<bam_url>/graphql") as client:
    client.authenticate(<username>, <password>)
    data = client.execute("query { configurations { name } }")
print(json.dumps(data, sort_keys=True, indent=4))

Here, query { configurations { name } } is an example of a GraphQL query. You can replace it with any GraphQL query that you want to experiment with.

Note: The GraphQL client is in an internal python module. As such, please expect changes to the python module name in future updates and releases.
Warning: This feature is experimental, in incubation, and may change or disappear in the future without further notice. Feedback is welcome!