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
- application/json
Root Schema : schema
Type:
Show Source
object
-
Query: string
Query SQLExample:
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
DatabaseID. QueryDBName or DatabaseID must be provided. QueryDBName takes precedence over DatabaseID if both are provided.Example:
1
-
QueryDBName: string
Database NameExample:
Assure1
-
QueryID: integer
Saved query ID. QueryName or QueryID must be provided. QueryName takes precedence over QueryID if both are provided.Example:
1005
-
QueryLimit: integer
Number of rows to selectExample:
100
-
QueryName: string
Query name as correlates to CoreDatabaseQueries.QueryName
-
QueryShardID: integer
Shard IDExample:
1
-
Tokens: array
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
Response
Supported Media Types
- application/json
200 Response
Successful operation
Nested Schema : SuccessfulAddOperation
Type:
Show Source
object
-
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
Device Zone IDExample:
1
-
DNSName: string
DNS NameExample:
someone.example.com
-
IPAddress: string
IP AddressExample:
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
Nested Schema : items
Type:
object