Python API Example
Example: The following example show on how to read retrieve data where equipment type is 'CHASIS'

Step 1: Import required library (CaaSClient)

1
from cfxdx.dataapi import CaaSClient
Copied!

Step 2: Credentials to connect to the system.

Use API keys to connect to the system
1
credentials = { "login-method": "access-key", "host": "hostname or ipaddress", "access-key": "value for API-access-key", "secret-key": "value for API-secret-key"}
Copied!
Step 3: Create CaaSClient object
1
client = CaaSClient(credentials, page_size=500)
Copied!
Step 4: Connect to inventory API and execute (alternative API )
1
inv = client.assetInventory()
Copied!

Step 5: Get the number of rows in inventory table

Step 6: Get number of modules in inventory
1
count = inv.count(cfxql_query="Equipment_Type is 'MODULE'")
Copied!
Step 7: Using Inventory API get all CHASSIS (return value is a pandas DataFrame object)
1
df = inv.get_data(cfxql_query="Equipment_Type is 'CHASSIS'", max_rows=1000)
Copied!
Now you can query the dataframe df using normal Pandas functions.
Last modified 7mo ago