Operational Insights Request REST API (3.0)

Download OpenAPI specification:

This API enables you to run Operational Insights Service requests and set request-level parameters.

Request

Enables you to execute a SQL++ for Operational Insights statement. This method allows you to run queries and modifying statements, and specify query parameters.

Authorizations:
AnalyticsManageAnalyticsAccess
Request Body schema:
required

An object specifying one or more query parameters.

statement
required
string

Specifies at least one valid SQL++ for Operational Insights statement to run.

client_context_id
string

An identifier passed by the client that is returned verbatim in the query response. Useful for matching a particular query to a specific caller.

format
string
Default: "JSON"
Value: "JSON"

Desired format for the query results.

Note that the only possible format is JSON.

pretty
boolean
Default: false

If true, the result is indented.

query_context
string
Default: "default:Default.Default"

A scope for the statement. The value of this parameter must start with default:, followed by a scope name. The default: prefix is a dummy and is ignored when resolving a collection name or synonym name.

readonly
boolean
Default: false

If true, then DDL statements are not allowed.

scan_consistency
string
Default: "not_bounded"
Enum: "not_bounded" "request_plus"

The consistency guarantee constraint for index scanning. If not_bounded, the query is executed immediately. If request_plus, the required collections are updated with data available from the Data service at the time of the request before the query is executed.

scan_wait
string
Default: ""

The maximum time to wait for collections to be updated before the query is executed. The format includes an amount and a unit: ns, us, ms, s, m, or h. The default is "" (no timeout).

timeout
string
Default: ""

Maximum time to spend on the request before timing out. The format includes an amount and a unit: ns, us, ms, s, m, or h. The default is "" (no timeout).

mode
string
Default: "immediate"
Enum: "immediate" "async"

The execution mode of the request. If immediate, the request is executed and the result is returned immediately. If async, the request is executed asynchronously and the client can retrieve the result later. All async requests can be viewed using the Open Requests endpoint, or going to the Open requests under the monitor page in UI workbench. The status and result of an async request can be retrieved using the endpoints described in Request Status and Retrieve Request Result.

result-ttl
string
Default: ""

Maximum time to retain the result of an async request. The format includes an amount and a unit: ns, us, ms, s, m, or h. The default is "" (use system default).

args
Array of any

An array of positional parameter values.

plan-format
string
Default: "JSON"
Enum: "JSON" "STRING"

The plan format.

logical-plan
boolean
Default: false

If true, the logical plan is included in the query response.

optimized-logical-plan
boolean
Default: true

If true, the optimized logical plan is included in the query response.

expression-tree
boolean
Default: false

If true, the expression tree is included in the query response.

rewritten-expression-tree
boolean
Default: false

If true, the rewritten expression tree is included in the query response.

job
boolean
Default: false

If true, the job details are included in the query response.

max-warnings
integer <int32>
Default: 0

An integer specifying the maximum number of warning messages to be included in the query response.

multi-statement
boolean
Default: false

If true, the request may contain more than 1 statement, separated by semicolons. If false, a request that contains more than 1 statement fails with error 21003.

The statements run in order. If a statement fails, the statements before it keep their responses and the statements after it are not executed.

A request with more than 1 statement returns a separate response for each statement in the statements array — refer to Query Responses. A request with only 1 statement returns the usual response, even when this parameter is true. USE, SET, and DECLARE FUNCTION statements do not count towards the number of statements, but they do get an entry of their own in the statements array.

A request with more than 1 statement cannot run in async mode, and fails with error 24320. The max-warnings limit applies to each statement separately.

property name*
additional property
any

A named parameter value.

Responses

Request samples

Content type
{
  • "statement": "string",
  • "client_context_id": "string",
  • "format": "JSON",
  • "pretty": false,
  • "query_context": "default:Default.Default",
  • "readonly": false,
  • "scan_consistency": "not_bounded",
  • "scan_wait": "",
  • "timeout": "",
  • "mode": "immediate",
  • "result-ttl": "",
  • "args": [
    ],
  • "property1": null,
  • "property2": null,
  • "plan-format": "JSON",
  • "logical-plan": false,
  • "optimized-logical-plan": true,
  • "expression-tree": false,
  • "rewritten-expression-tree": false,
  • "job": false,
  • "max-warnings": 0,
  • "multi-statement": false
}

Response samples

Content type
application/json
{
  • "requestID": "string",
  • "handle": "string",
  • "clientContextID": "string",
  • "signature": { },
  • "results": [
    ],
  • "status": "success",
  • "errors": [
    ],
  • "warnings": [
    ],
  • "metrics": {
    },
  • "plans": {
    },
  • "statements": [
    ]
}

Read-Only Request

Enables you to execute a SQL++ for Operational Insights statement. This method only allows you to run queries and specify query parameters. It does not allow you to run modifying statements.

This is intended for situations where use of the POST method is restricted.

Authorizations:
AnalyticsManageAnalyticsAccess
query Parameters
required
object (Query Parameters)

Specify the parameters in the query URL in URL-encoded format.

Responses

Response samples

Content type
application/json
{
  • "requestID": "string",
  • "handle": "string",
  • "clientContextID": "string",
  • "signature": { },
  • "results": [
    ],
  • "status": "success",
  • "errors": [
    ],
  • "warnings": [
    ],
  • "metrics": {
    },
  • "plans": {
    },
  • "statements": [
    ]
}

Request Status

Enables you to get the status of a request that was executed in async mode.

Authorizations:
AnalyticsManageAnalyticsAccess
path Parameters
request_id
required
string <UUID>

The unique identifier of the request.

job_id
required
string

The identifier of the job associated with the request.

Responses

Response samples

Content type
application/json
{
  • "status": "success",
  • "handle": "string",
  • "resultCount": 0,
  • "partitions": [
    ],
  • "resultSetOrdered": true,
  • "errors": [
    ],
  • "warnings": [
    ],
  • "metrics": {
    },
  • "createdAt": "2019-08-24T14:15:22Z"
}

Retrieve Request Result

Enables you to retrieve the result of a request that was executed in async mode.

Authorizations:
AnalyticsManageAnalyticsAccess
path Parameters
request_id
required
string <UUID>

The unique identifier of the request.

job_id
required
string

The identifier of the job associated with the request.

Responses

Response samples

Content type
application/json
{
  • "results": [
    ],
  • "metrics": {
    },
  • "profile": { },
  • "createdAt": "2019-08-24T14:15:22Z"
}

Discard Request Result

Enables you to discard the result of a request that was executed in async mode.

Authorizations:
AnalyticsManageAnalyticsAccess
path Parameters
request_id
required
string <UUID>

The unique identifier of the request.

job_id
required
string

The identifier of the job associated with the request.

Responses