RunCustomQuery
Command, Introduced in version 26.6
POST https://localhost:8001/sv/001.1/api/v1/Common/Commands/RunCustomQuery
Runs a custom SQL query and returns its result set.
Custom queries are created in the procedure Custom queries in Monitor. The query to run is identified by
its QueryId, which is shown as Unique Id in the procedure.
The query must be active and available to the current user.
Returns an object whose Data property contains the result set encoded as a JSON string, in the
shape selected by ResultFormat.
Properties
| Name | Type | Summary | Introduced in |
|---|---|---|---|
| QueryId | Guid | The unique id of the custom query to run, e.g. 3F2504E0-4F89-41D3-9A0C-0305E82C3301.It is shown as Unique Id in the procedure Custom queries in Monitor.
|
|
| Parameters | CustomQueryParameterValue[] | Optional values for the parameters defined on the custom query, e.g. a parameter with the nameCustomerCode and the value ACME. Each name must match a CustomQueryParameterson the query. Parameters that are not included use their default value from the query. |
|
| ResultFormat | Int32 | Controls the JSON shape of the result. Defaults to with the column names as keys. Use names once and each row as an array of values, which gives a smaller response for large result sets.
|
Example
Given a custom query with the Unique Id 3F2504E0-4F89-41D3-9A0C-0305E82C3301, the SQL
SELECT OrderNumber, OrderDate FROM ... WHERE CustomerCode = :CustomerCode
and a parameter named CustomerCode of type String, the following request runs the query for
customer ACME:
{
"QueryId": "3F2504E0-4F89-41D3-9A0C-0305E82C3301",
"Parameters": [
{
"Name": "CustomerCode",
"Value": "ACME"
}
]
}
ResultFormat is omitted, so the result is returned in the Verbose format:
{
"Data": "[{\"OrderNumber\":\"1001\",\"OrderDate\":\"2026-01-15T00:00:00\"},{\"OrderNumber\":\"1002\",\"OrderDate\":\"2026-02-03T00:00:00\"}]"
}
JSON
{
"QueryId": "00000000-0000-0000-0000-000000000000",
"Parameters": null,
"ResultFormat": 0
}