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
- application/json
Root Schema : schema
Type:
Show Source
object
-
Query: string
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)
-
QueryDatabaseID: integer
The database ID. You must specify either QueryDBName or QueryDatabaseID. If you specify both, QueryDBName is used.Example:
1
-
QueryDBName: string
The database name. You must specify either QueryDBName or QueryDatabaseID. If you specify both, QueryDBName is used.Example:
Assure1
-
QueryID: integer
The query ID. You must specify either QueryName or QueryID. If you specify both, QueryName is used.Example:
1005
-
QueryLimit: integer
The number of rows to select.Example:
100
-
QueryName: string
The query name, correlated to CoreDatabaseQueries.QueryName.
-
QueryShardID: integer
The shard ID.Example:
1
-
Tokens: array
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
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 : items
Type:
object
Response
Supported Media Types
- application/json
200 Response
Successful operation
Root Schema : schema
Match All
Show Source
-
object
SuccessfulAddOperation
The response body for a successful add operation.
-
object
type
Nested Schema : SuccessfulAddOperation
Type:
object
The response body for a successful add operation.
Show Source
-
message: string
The response message.Example:
Added record
-
success: boolean
Whether the operation was a success (true) or a failure (false).Example:
true
Nested Schema : type
Type:
Show Source
object
-
data: array
data
The DNS name, IP address and device zone ID of the query that was run.
-
metaData: object
metaData
The meta data for the received list.
-
total: integer
The total number of results regardless of paging.Example:
2
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
-
columns: array
columns
An array of information describing how the columns should be presented.
-
fields: array
fields
An array of column header descriptions.
-
root:
Example:
data
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:
Show Source
object
-
DeviceZoneID: integer
The device zone ID.Example:
1
-
DNSName: string
The DNS name.Example:
someone.example.com
-
IPAddress: string
The IP address.Example:
1682824301
Nested Schema : columns
Type:
array
An array of information describing how the columns should be presented.
Show Source
Nested Schema : items
Type:
Show Source
object
-
dataIndex:
Example:
DNSName
-
filter:
Example:
string
-
flex:
Example:
1
-
header:
Example:
DNSName
-
minWidth:
Example:
100
Default Response
Failed operation
Root Schema : schema
Type:
Show Source
object
-
errors: array
errors
The list of errors reported. Validation errors will be keyed by record field.
-
message: string
The response message.Example:
Exception thrown
-
success: boolean
Whether the operation was a success (true) or a failure (false).Example:
false
Nested Schema : errors
Type:
array
The list of errors reported. Validation errors will be keyed by record field.
Show Source
-
Array of:
object items
An error.
Nested Schema : items
Type:
object
An error.