Run a Query

post

/api/database/QueryTools/executeQuery

Runs the query that matches the specified parameters.

Request

There are no request parameters for this operation.

Supported Media Types
Request Body - application/json ()
Root Schema : schema
Type: object
Show Source
  • Query SQL
    Example: SELECT d.DNSName, d.IPAddress, d.DeviceZoneID FROM Devices AS d WHERE d.DNSName != '' AND d.DeviceID NOT IN (SELECT DeviceID FROM DeviceInterfaces WHERE DeviceID = d.DeviceID)
  • DatabaseID. QueryDBName or DatabaseID must be provided. QueryDBName takes precedence over DatabaseID if both are provided.
    Example: 1
  • Database Name
    Example: Assure1
  • Saved query ID. QueryName or QueryID must be provided. QueryName takes precedence over QueryID if both are provided.
    Example: 1005
  • Number of rows to select
    Example: 100
  • Query name as correlates to CoreDatabaseQueries.QueryName
  • Shard ID
    Example: 1
  • Tokens
    JSON string of tokens the query expects and the variables or values to replace them The API expects Tokens to be an array of name/value objects such as [{"name":"foo","value":"bar"}]. The following example expects the tokens DeviceID and MetricID for query 1234: my.server.com/api/database/QueryTools/executeQuery?QueryID=1234&Tokens=[{"name":"DeviceID","value":"234"},{"name":"MetricID","value":"345"}]
Nested Schema : Tokens
Type: array
JSON string of tokens the query expects and the variables or values to replace them The API expects Tokens to be an array of name/value objects such as [{"name":"foo","value":"bar"}]. The following example expects the tokens DeviceID and MetricID for query 1234: my.server.com/api/database/QueryTools/executeQuery?QueryID=1234&Tokens=[{"name":"DeviceID","value":"234"},{"name":"MetricID","value":"345"}]
Show Source
Nested Schema : items
Type: object
Back to Top

Response

Supported Media Types

200 Response

Successful operation
Body ()
Root Schema : schema
Match All
Show Source
Nested Schema : SuccessfulAddOperation
Type: object
Show Source
Nested Schema : type
Type: object
Show Source
Nested Schema : data
Type: array
The DNS name, IP address and device zone ID of the query that was run.
Show Source
Example:
[
    {
        "DNSName":"someone.example.com",
        "IPAddress":"1682824301",
        "DeviceZoneID":"1"
    },
    {
        "DNSName":"testing",
        "IPAddress":"1682824301",
        "DeviceZoneID":"1"
    }
]
Nested Schema : metaData
Type: object
The meta data for the received list.
Show Source
Example:
{
 "root": "data",
 "columns": {
                "header": "DNSName",
                "dataIndex": "DNSName",
                "filter": "string",
                "flex": "1",
                "minWidth": "100"
              },
              {
                "header": "IPAddress",
                "dataIndex": "IPAddress",
                "filter": "int",
                "flex": "1",
                "minWidth": "100"
              },
              {
                "header": "DeviceZoneID",
                "dataIndex": "DeviceZoneID",
                "filter": "int",
                "flex": "1",
                "minWidth": "100"
              },
 "fields": [
      "DNSName",
      "IPAddress",
      "DeviceZoneID"
    ]
}
Nested Schema : databaseQueryToolsResponseData
Type: object
Show Source
Nested Schema : columns
Type: array
An array of information describing how the columns should be presented.
Show Source
Nested Schema : fields
Type: array
An array of column header descriptions.
Show Source
Nested Schema : items
Type: object
Show Source

Default Response

Failed operation
Body ()
Root Schema : schema
Type: object
Show Source
Nested Schema : errors
Type: array
The list of errors reported. Validation errors will be keyed by record field.
Show Source
Nested Schema : items
Type: object
Back to Top