Skip to main content
POST
Query data source rows

Restrictions

Usage

  • The request is forwarded to monit-edge over WebSocket; the data source named by ds_type + ds_name must already exist under the calling account.
  • account_id in the body is optional. When supplied it must equal the authenticated account; mismatched values are rejected.
  • Two error layers: webapi-level failures use the standard error envelope, but errors raised by monit-edge while executing the query are returned as HTTP 200 with an error object in the body. Always check the response body for error in addition to the HTTP status.
  • monit-edge enforces a row cap; large result sets come back as error.message = "too many rows". Narrow the time range or aggregate at the source.
  • args is a polymorphic string→string map that is forwarded verbatim. Semantics depend on ds_type (SLS requires sls.project + sls.logstore; Loki / VictoriaLogs raw mode requires a time range via *.start/*.end or *.timespan.value/*.timespan.unit; Prometheus and SQL sources ignore it). See the monit-webapi query-api docs for the per-source key list.

Authorizations

app_key
string
query
required

App key issued from the Flashduty console under Account → APP Keys. Required on every public API call. Keep it secret — it grants the same access as the owning account.

Body

application/json
ds_type
string
required

Data source type; must match a configured data source under the tenant. Examples: prometheus, loki, victorialogs, sls, elasticsearch, mysql, postgres, oracle, clickhouse.

ds_name
string
required

Data source name; must match a configured data source under the tenant.

expr
string
required

Query expression. Syntax depends on ds_type and is interpreted by the corresponding monit-edge client (PromQL for Prometheus, LogQL for Loki, SQL for SQL sources, etc.).

account_id
integer<int64>

Optional consistency check. Must equal the authenticated account when supplied; mismatched values are rejected. Business execution always uses the authenticated account.

delay_seconds
integer
default:0

Look-back offset in seconds applied to point-in-time queries (Prometheus, Loki stats, VictoriaLogs stats). Ignored for raw / detail queries.

args
object

Polymorphic key/value extension parameters forwarded verbatim to monit-edge. All values must be strings. Semantics depend on ds_type: SLS requires sls.project + sls.logstore; Loki / VictoriaLogs raw mode requires a time range via <source>.start/<source>.end or <source>.timespan.value + <source>.timespan.unit; Prometheus and SQL sources ignore it. Always namespace keys by source (e.g. sls.project, loki.type).

Response

Success

Success response envelope. On every 2xx response, request_id identifies the call (also mirrored in the Flashcat-Request-Id header) and data holds the endpoint-specific payload. Failure responses use a different shape — see ErrorResponse.

request_id
string
required

Unique ID for this request. Mirrored in the Flashcat-Request-Id response header. Include it when reporting issues.

Example:

"01HK8XQE3Z7JM2NTFQ5YJ8P9R4"

data
object[]
required

Result rows. Different data sources populate fields vs values differently — metric sources (Prometheus, *-stats) put numbers into values; detail sources (SQL, SLS, raw logs) put data into fields and may return values: null.