AIA API
Fetch inventory data through AIA API
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.

Python-based CLI to get inventory data:

Download the python package using the below command.
1
wget https://macaw-amer.s3.amazonaws.com/releases/AIA/caas-rest-client/caas-rest-client.tar
Copied!
The prerequisite is to have python 3.7.4 or above environment
Extract the Python package using the below command.
1
tar -xvf caas-rest-client.tar
Copied!
Configure the configfile.json with the user's access-key and secret-key
1
cd caas-rest-client
2
3
cat configfile.json
4
5
{
6
"secure": true,
7
"host": "<ip-address-of-cfxaia-platform>",
8
"login-method": "access-key",
9
"access-key": "<access-key-id>",
10
"secret-key": "<secret-key-id>"
11
}
Copied!
  • 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.
1
python cfx_client.py --configfile configfile.json --get defs --app lcm-manager-customer --page assetLCMMaster
Copied!
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.
1
python cfx_client.py --configfile configfile.json --get report --uri "uri:///reports?source=lcm-manager-customer&repository=assetLCMMaster&id=56c98b9e-aa39-4cbd-9c42-e23d8012258a"
Copied!
Use --curl option to see auto generated full curl command with syntax for the requested report.
1
python cfx_client.py --configfile configfile.json --get report --uri "uri:///reports?source=lcm-manager-customer&repository=assetLCMMaster&id=56c98b9e-aa39-4cbd-9c42-e23d8012258a" --curl
Copied!
Use --filter option to apply the filters to limit the scope of the data from a report
1
python cfx_client.py --configfile configfile.json --get report --uri "uri:///reports?source=lcm-manager-customer&repository=assetLCMMaster&id=8cb11886-905a-409d-b988-18db5a957147" --filter "Equipment_Type in 'CHASSIS'"
Copied!
Please refer CFXQL based filtering documentation for more information.

Get API session auth token using the user's access key and secret key:

The below example shows how to run a curl command to get an API session auth token.
1
curl -k -X POST -H 'Content-Type: application/json' \
2
-d '{"login-method": "access-key", "access-key-id": "52249240-8909-48b5-879e-0df5801c831e", "secret-key": "d76f648f-9eb3-4213-9eea-8c40fb9232d4"}' \
3
https://10.95.117.30/api_gateway/login
Copied!
API Response will include apiGatewaySessionId which needs to be used as an X-Auth-Token header in subsequent API queries to retrieve the data.
1
{"apiGatewaySessionId":"1674bd45-2c90-4229-9530-909e50ddf9ce",......
Copied!
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.
Page Name
Source
Repository
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
Below API query gets all of the available repositories under the source lcm-manager-customer within the AIA application
1
curl -k -X POST -H 'content-type: application/json' \
2
-H 'X-Auth-Token: c8aa75d6-5bb4-42b4-8e75-f710edc14a6e' \
3
-d '{"params": ["getReportRepositories", "{\"source\": \"lcm-manager-customer\"}"]}' \
4
https://10.95.117.30:443/api_gateway/service/io.cfx.dimensions.app/reports-registry/1.0.0/invokeAppApi
Copied!
API Response:
1
[
2
"admFilters",
3
"contract-details",
4
"projectionRateDictionary",
5
"replacementProjection",
6
"assetLCMMaster",
7
"ipTelephony"
8
]
Copied!
Below API query gets all available report definitions under 'assetLCMMaster' repository.
1
curl -k -X POST -H 'content-type: application/json' \
2
-H 'X-Auth-Token: 1674bd45-2c90-4229-9530-909e50ddf9ce' \
3
-d '{"params": ["getReportsBySourceAndRepositoryName", "{\"source\": \"lcm-manager-customer\", \"repository\": \"assetLCMMaster\"}"]}' \
4
https://10.95.117.30:443/api_gateway/service/io.cfx.dimensions.app/reports-registry/1.0.0/invokeAppApi
Copied!
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.
1
[
2
{
3
"id": "61297c45-b6c6-4ee5-bb77-0751b4162348",
4
"description": "Total Number of Vendors",
5
"definition": {
6
"dataset_tag": "asset-db:assetLCMMaster",
7
"type": "COUNTER_TABLE",
8
"title": "Total Number of Vendors",
9
"limit": "10",
10
"series_cols": [
11
"Vendor"
12
],
13
"function": "UNIQUE",
14
"filter": null
15
},
16
"report-uri": "uri:///reports?source=lcm-manager-customer&repository=assetLCMMaster&id=61297c45-b6c6-4ee5-bb77-0751b4162348"
17
}
Copied!
For fetching 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.
1
curl -k -X POST -H 'content-type: application/json' \
2
-H 'X-Auth-Token: 1674bd45-2c90-4229-9530-909e50ddf9ce' \
3
-d '{"params": ["getChartData", "{\"url\": \"uri:///reports?source=lcm-manager-customer&repository=assetLCMMaster&id=56c98b9e-aa39-4cbd-9c42-e23d8012258a\", \"filters\": []}"]}' \
4
https://10.95.117.30:443/api_gateway/service/io.cfx.dimensions.app/dataset-caas/1.0.0/invokeAppApi
Copied!