API requests and reporting
Introduction
This article showcases example requests to the various data APIs supported by DCT.
DCT provides interactive API documentation that allows users to experiment with the APIs in their web browser. The interactive API documentation can be accessed by entering the hostname for DCT and the /api path into a browser's address bar. For example, if DCT is running on host gateway.example.com, then enter https://gateway.example.com/api into the browser's address bar.
To simplify development, Python and Go programming libraries are available. The Python bindings can be found on PyPi here. The latest version can be installed with the following command:
pip install delphix-dct
The Go bindings can be found on go.dev here.
Engines
This section showcases some examples of querying the Engines endpoint for information about connected Delphix Virtualization Engines. These examples leverage the generated Python bindings:
import delphix.api.gateway
import delphix.api.gateway.configuration
import delphix.api.gateway.api.management_api
cfg = delphix.api.gateway.configuration.Configuration()
cfg.host = "https://localhost/v2"
# For example purposes
cfg.verify_ssl = False
# Replace the string with your own API key
cfg.api_key['ApiKeyAuth'] = 'apk 3.tEd4DXFce'
api_client = delphix.api.gateway.ApiClient(configuration=cfg)
engines_api = delphix.api.gateway.api.management_api.ManagementApi(api_client)
print(engines_api.get_registered_engines())
The result should appear similar to the following:
{'items': [{'connection_status': 'ONLINE',
'cpu_core_count': 2,
'data_storage_capacity': 23404216320,
'data_storage_used': 11589626880,
'hostname': 'avm.delphix.com',
'id': 1,
'insecure_ssl': True,
'memory_size': 8589934592,
'name': 'vmname',
'password': '******',
'status': 'CREATED',
'tags': [],
'type': 'UNSET',
'unsafe_ssl_hostname_check': False,
'username': 'admin',
'uuid': 'ec2fbfea-928b-07f8-94c4-29fea614624f',
'version': '6.1.0.0'}]}