Extracting data from the data mart by using the API
Scenario
Paul is a capacity planner in an IT organization. He manages and monitors the capacity views in his organization to ensure that the existing infrastructure capacity has sufficient resources to meet the current and future demands. Paul wants to access the data of the VMWARE_VF_CL_CAPACITY data mart with an external client using the API. He particularly wants to view the list of clusters where the CPU utilization exceeds 80%.
Workflow
Paul has to make sure that he has access to the APIs. He requests Alan, the administrator to provide him access to use the APIs. After Paul has access to the APIs, he can use the APIs to extract the data from the data mart.
Task 1: Find the ID of the data mart
Paul has to first find the ID of the VMWARE_VF_CL_CAPACITY data mart so that he can proceed with the API calls. To find the data mart ID, Paul logs on to TrueSight Capacity Optimization and does the following:
- Navigate to Administration > Data marts.
- In the Name column, search for the VMWARE_VF_CL_CAPACITY data mart.
- The Id column displays the ID of the data mart.
Task 2: Extract the data from the data mart
Using the data mart ID, Paul can extract the data from the data mart. He uses this API call:
POST https://<BMC Helix Portal URL>/opt/api/v1/datamartservice/datamarts/1688/data
Example: POST https://host1.bmc.com/opt/api/v1/datamartservice/datamarts/1688/data
Parameters | Example |
---|---|
Request body | |
Response |
Task 3: Add a filter condition to limit the results displayed
After viewing the default response results, Paul can add filters to view only the required data. In this case, since Paul wants to view only the details of the clusters where the CPU utilization is more than 80%. He can use this request:
POST https://<BMC Helix Portal URL>/opt/api/v1/datamartservice/datamarts/1688/data
Example: POST https://host1.bmc.com/opt/api/v1/datamartservice/datamarts/1688/data
Parameters | Example |
---|---|
Request body | |
Response |
Time filters
In addition to generic filters, the data mart API also supports time filters. The following table explains the time filters and their syntax.
Time filter | Syntax |
---|---|
Last X days | |
Predefined | |
Date range |
Additional information about the filters
- You can apply a filter on any column of your data mart.
- You can add one or more filters to your request. All filters are evaluated in AND condition.
Let's say that in addition to the clusters that are exceeding CPU utilization of 80%, Paul also wants to see the clusters where the memory utilization is less than 50%. Paul can add an additional filter in the body of the request as follows:
List of filter conditions
Results
Paul is able to view the list of clusters where the CPU utilization exceeds 80% using the Data mart API.