Run a Query

post

/api/database/QueryTools/executeQuery

Runs the query that matches the specified parameters. At minimum, the QueryDBName property is required in the request body.

Request

There are no request parameters for this operation.

Supported Media Types
Request Body - application/json ()
Root Schema : schema
Type: object
Show Source
  • The 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)
  • The database ID. You must specify either QueryDBName or QueryDatabaseID. If you specify both, QueryDBName is used.
    Example: 1
  • The database name. You must specify either QueryDBName or QueryDatabaseID. If you specify both, QueryDBName is used.
    Example: Assure1
  • The query ID. You must specify either QueryName or QueryID. If you specify both, QueryName is used.
    Example: 1005
  • The number of rows to select.
    Example: 100
  • The query name, correlated to CoreDatabaseQueries.QueryName.
  • The shard ID.
    Example: 1
  • Tokens
    The JSON object with an array of name-value pairs to replace with values from the query.
    For example, to get DeviceID and Metric ID with query 1234, use the following: <hostFQDN>/api/database/QueryTools/executeQuery?QueryID=1234&Tokens=[{"name":"DeviceID","value":"234"},{"name":"MetricID","value":"345"}]
Nested Schema : Tokens
Type: array
The JSON object with an array of name-value pairs to replace with values from the query.
For example, to get DeviceID and Metric ID with query 1234, use the following: <hostFQDN>/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
The response body for a successful add operation.
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
An error.
Back to Top