Generic query

Predictive Maintenance and Quality provides an API that you can use to run generic queries.

To run a generic query, run a shell command similar to the following example:

curl -k -u user1:passw0rd "https://<hostname>:<port>/ibm/pmq/api/common?table=<table_name>&kpi=<true|false>&style=<transaction>&columns<COLUMN_1>,<COLUMN_2>&timeStart=<yyyy-mm-dd>&timeEnd=<yyyy-mm-dd>&filter=<COLUMN_FILTER>&entities=<entity_list>"

The options of this command are described in the following table.

Table 1. Curl command for generic queries
Field Definition Comments
table Defines on which table you want to run the query. Required
kpi

Defines if the table is a KPI table or not. The values include true or false.

Optional
style Defines if the KPI table saves transactional data or dimensional data. The values include transaction and dimension. Currently, only transaction is available. Required when the KPI value is true.
columns

A collection of attributes and key values that are only available when the KPI value is true. Any column names except KEY/VALUE can be used as attributes. If no attribute is defined, all possible attributes are returned. Any value in the KEY column can be used as a key value. If no key is defined, all possible keys are returned.

Required when the KPI value is true.
timeStart, timeEnd Time range of the events. Required when the KPI value is true.
filter Provides a filter so that the API returns rows that meet the filter. The filter on works when the KPI value is true. Optional
entities Entity list that you want to query. Optional
Note: To avoid queries that return too much data, there is a limit of 100,000 rows.

The following shell commands are examples:

curl -k -u user1:passw0rd "https://localhost:9443/ibm/pmq/api/common?table=language"

curl -k -u user1:passw0rd "https://localhost:9443/ibm/pmq/api/common?table=anylift"

curl -k -u user1:passw0rd "https://localhost:9443/ibm/pmq/api/common?table=anylift&kpi=true&timeStart=2011-11-17&timeEnd=2017-11-17&style=transaction&columns=rms_x,rms_y,re_opens&filter=re_opens=0"

curl -k -u user1:passw0rd "https://localhost:9443/ibm/pmq/api/common?table=anylift&kpi=true&timeStart=2011-11-17&timeEnd=2017-11-17&style=transaction&entities=357042064191878,357042064191879"