AIA API
Fetch inventory data through AIA API
Last updated
Fetch inventory data through AIA API
Last updated
In the CloudFabrix AIA application, users can use its RESTful API interface to query and get the inventory data.
Follow the below instructions to generate an access key and secret key for the logged-in user, which will be used for authentication while accessing the APIs.
Login into CloudFabrix AIA portal.
Click on Main Menu as shown below.
Click on Drop Down menu as shown below and click on Access Keys
Click on the + button to generate a new access key and secret key
Save the secret key from the pop-up window before closing it.
The access key is shown once the above pop-up window is closed.
API Details and Usage:
Use below three APIs to query and get the inventory data:
getReportRepositories - API for fetching all of the available repositories under the source lcm-manager-customer/asset-app-dependency within the AIA application.
getReportsBySourceAndRepositoryName - API for fetching all available report definitions under 'assetLCMMaster' repository.
getChartData_v1 - API for fetching the inventory data from a report, this API requires the url of the report (i.e. report-uri
).
The API needs Source & Repository. These values are based on the page where the report resides in UI. Below table gives these values for different pages.
Each report in AIA has a Report ID in UUID format. Below are few example Report ID’s of some of the reports in AIA.
Overall --> Assets by POR --> HW Devices POR Status (Report ID: cb0af4b2-60f3-4066-aefa-5d9afe36296e
)
Hardware --> HW Assets by POR --> HW Devices POR Status by Role (Report ID: 3aacdd76-5e89-41f1-bb46-ab81a0b4b1d1
)
Overview --> Apps by Site Code (Report ID: b2910f73-3ae7-4c02-b2af-5330f5b204b7
)
Please follow the below instructions to download and use the python package.
Download the python package using the below command.
The prerequisite is to have python 3.7.4 or above environment
Extract the Python package using the below command.
Configure the configfile.json with the user's access-key and secret-key
host: AIA platform's IP address
access-key: User's API access key id generated in the above steps
secret-key: User's API secret key id generated in the above steps
Once configfile.json is configured with appropriate API credentials, run the below command to list all of the available reports and their metadata definitions. Save the output to a file to see all of the available report definitions.
Report definitions are nothing but metadata of each widget (pie chart, tabular chart, etc..) available within the AIA portal under different pages/reports. Each report will have a URI path which will be used to query the data.
Below command provides an example URI of a report that fetches the inventory data of that report.
Use --curl
option to see auto generated full curl command with syntax for the requested report.
Use --filter
option to apply the filters to limit the scope of the data from a report
Get report API syntax details:
Please refer CFXQL based filtering documentation for more information.
To call RESTful APIs of AIA application, users can create their own python script with the help of macaw_helper
python module provided in the above mentioned caas-rest-client package.
macaw_helper
module takes care of session management by logging into the api gateway of AIA application automatically by using access-key, secret-key or by username and password.
Import 'macawclient
' class from macaw_helper python module, and use 'myInvokeService
' method in macawclient
for API query.
Need to provide the configuration details while creating an instance to macawclient
. Below is the example to pass configuration details to macawclient
3. Use 'myInvokeService
' method from macawclient
to query any RESTful API. Below are the inputs needed for myInvokeService
4. Below are some of the examples to query an API using ‘myInvokeService
’ from macawclient
class
To call "getReportsBySourceAndRepositoryName" api from reports-registry service for fetching all available report definitions under 'assetLCMMaster' repository
Each report definition from the above API response will have a report-uri
string as shown in the below output, which is needed while querying the inventory data.
To call "getChartData_v1
" api for fetching the inventory data from a report, this API requires url (i.e. report-uri
)
The below example shows how to run a curl command to get an API session auth token.
API Response will include apiGatewaySessionId which needs to be used as an X-Auth-Token header in subsequent API queries to retrieve the data.
CloudFabrix AIA application's API needs Source & Repository details as input while querying the inventory data. These values are based on the page where the report resides in the AIA UI. The below table gives these values for different pages.
Below API query gets all of the available repositories under the source lcm-manager-customer within the AIA application
API params:
getReportRepositories: API to get existing repositories of a source within the AIA application.
source: Specify the source name. Supported values are listed in the above table
API Response:
Below API query gets all available report definitions under 'assetLCMMaster' repository.
API params:
getReportsBySourceAndRepositoryName: API to get available reports metadata/definition from a specified repository
source: Specify the source name of a repository. Supported values are listed in the above table
repository: Specify the repository name. Supported values are listed in the above table
Each report definition from the above API response will have a report-uri string like the below example output capture, which is needed while querying the inventory data from that report.
Querying the Inventory data:
Example-1: For querying the inventory data from a report, API requires url (i.e. report-uri from the above API's response) and filters as input parameters as shown in the below example.
API params:
getChartData_v1: API to query the inventory data from a report, supports paginated data
url: URI of a report from report repository to get the inventory data
filters: (optional) supports CFXQL based filter syntax to filter the data.
column-type: pass-through (fixed value, mandatory)
values: CFXQL syntax based filter
Note: url
and subsequent params
need to be passed in stringified json format
Note: getChartData
API to query the inventory data has been deprecated and it has been replaced with getChartData_v1
API. This new API has bug fixes and optimizations when querying the larger data with pagination support.
Example-2: In the below API example, apply the filter to query (using CFXQL format) Cisco vendor devices.
API params:
getChartData_v1: API to query the inventory data from a report, supports paginated data
url: URI of a report from report repository to get the inventory data
filters: (optional) support CFXQL based filter syntax to filter the data.
column-type: pass-through (fixed value, mandatory)
values: CFXQL syntax based filter
Example-3: In the below API example, apply the filter to query (using CFXQL format) Cisco vendor devices and filter only Chassis out of them.
Example-4: In the below API example, it uses the below API properties to query the inventory data from a paginated report.
API params:
getChartData_v1: API to query the inventory data from a report, supports paginated data
url: URI of a report from report repository to get the inventory data
filters: (optional) supports CFXQL based filter syntax to filter the data.
column-type: pass-through (fixed value, mandatory)
values: CFXQL syntax based filter
properties: (for paginated reports)
offset: 0-n (starts from 0)
maxResults: 1 to 5000 (default: 20) - records per paginated query.
Dataset tags are the raw data source tables for all of the reports in the UI. Below are the two available APIs to query the inventory data from dataset tags.
getDatasetTags: To query and list all the available dataset tags.
executeCFXQLQuery: To query a specific dataset tag and retrieve the inventory data from it using CFXQL based filters. This API also support, querying only selective columns from the selected dataset tag.
Dataset Tags list:
Below API example queries list of available dataset tags from AIA application.
API params:
getDatasetTags: API to query the list of available dataset tags
context: null (fixed value, mandatory)
Querying the Inventory data from Dataset Tags:
Example-1: Below API example queries the specified dataset tag 'asset-db:assetLCMMaster' and gets the inventory data. By default i gets only 20 records in the response.
API params:
executeCFXQLQuery: To query a specific dataset tag and retrieve the inventory data from it using CFXQL based filters. This API also support, querying only selective columns from the selected dataset tag.
tag: dataset tag name (mandatory: please refer the above dataset tags table for more information)
cfxql_query: CFXQL query with or without 'GET' columns option. * means get all columns without applying any filters.
Example-2: Below API example queries the specified dataset tag 'asset-db:assetLCMMaster' and get first 1000 records from the inventory data. It supports paginated reports.
API params:
executeCFXQLQuery: To query a specific dataset tag and retrieve the inventory data from it using CFXQL based filters. This API also support, querying only selective columns from the selected dataset tag.
tag: dataset tag name (mandatory: please refer the above dataset tags table for more information)
offset: 0-n (starts from 0)
maxResults: 1 to 1000 (default: 20) - records per paginated query.
cfxql_query: CFXQL query with or without 'GET' columns option. * means get all columns without applying any filters.
Example-3: Below API example queries the specified dataset tag 'asset-db:assetLCMMaster' and get first 1000 records from the inventory data after applying a filter to limit the records to Equipment_Type is 'CHASSIS'
Note: In this executeCFXQLQuery API query, within the cfxql_query filter, for single quoted values (applicable for both filter values and selected columns to be reported as different names), each single quote need to be escaped in a specific format as shown in the above example. i.e. ' (each single quote) --> '\'' (escaped with single quote, back slash followed by 2 single quotes)
Example-4: Below API example queries the specified dataset tag 'asset-db:assetLCMMaster' and get first 1000 records from the inventory data after applying a filter to limit the records to Equipment_Type is 'CHASSIS' with only selected columns. (get IP_Address, DNS_Name, customerName as 'Customer Name')
Example-5: Below API example queries the specified dataset tag 'asset-db:assetLCMMaster' and get first 1000 records from the inventory data after applying a filter to limit the records to Equipment_Type is 'CHASSIS', Vendor is 'Cisco' & Site_Type is 'Data Center' with only selected columns. (get IP_Address, Hostname, Region, Site)
Page Name in UI | Source | Repository |
---|---|---|
Page Name in UI | Source | Repository |
---|---|---|
Name | Description |
---|---|
Overall
lcm-manager-customer
assetLCMMaster
POR Insights
lcm-manager-customer
replacementProjection (or) assetLCMMaster
HW Assets
lcm-manager-customer
assetLCMMaster
SW Assets
lcm-manager-customer
assetLCMMaster
Contracts
lcm-manager-customer
contract-details
App Dependency
asset-app-dependency
adm
Assets List
lcm-manager-customer
assetLCMMaster
Overall
lcm-manager-customer
assetLCMMaster
POR Insights
lcm-manager-customer
replacementProjection (or) assetLCMMaster
HW Assets
lcm-manager-customer
assetLCMMaster
SW Assets
lcm-manager-customer
assetLCMMaster
Contracts
lcm-manager-customer
contract-details
App Dependency
asset-app-dependency
adm
Assets List
lcm-manager-customer
assetLCMMaster
asset-db:assetLCMMaster
Datasource of network devices inventory data that includes Chassis, Module, Power Supplies, aggregated interfaces state data etc. (UI Reference: AIA --> Assets List --> Network --> Assets Details)
asset-db:all_cdp
Datasource of network device's CDP neighbors data (UI Reference: AIA --> Assets List --> Network --> CDP Neighbors)
asset-db:aia_interface_poe
Datasource of network device's Interface states along with PoE data (UI Reference: AIA --> Hardware --> Network --> HW Assets by PoE)
asset-db:adm-apps
Datasource of network device's end point connectivity data (a.k.a ADM: application (hosts) dependency mapping) (UI Reference: AIA --> App Dependency). It includes all of the raw columns related to App Dependency data.
asset-db:adm-apps-network-overview
Datasource of network device's end points and applications summary reports (UI Reference: AIA --> App Dependency --> Overview)
asset-db:adm-apps-network
Datasource of network device's detailed information and brief information connected applications (UI Reference: AIA --> App Dependency --> Device Details)
asset-db:adm-apps-applications
Datasource of network device's brief information and detailed information on connected applications (UI Reference: AIA --> App Dependency --> App Details)