Preview datasource query
Execute a synchronous datasource query and return the raw result. Used to preview alert rule expressions before saving.
Restrictions
Usage
ds_typemust match the datasource type (e.g.prometheus,loki).ds_nameis the display name of the datasource as configured in the account.delay_secondsshifts the query window backward by the specified number of seconds, useful for accommodating data ingestion latency.- The response body is the raw JSON returned by the datasource — its schema varies by datasource type.
Authorizations
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
Parameters for a synchronous datasource query preview.
Datasource type, e.g. prometheus, loki, elasticsearch.
Datasource display name as configured in the account.
Query expression. Format depends on ds_type (PromQL for Prometheus, LogQL for Loki, etc.).
Shift the query window backward by this many seconds to compensate for data ingestion latency.
Additional datasource-type-specific query arguments (string keys and values), e.g. sls.project and sls.logstore for SLS, es.type for Elasticsearch, loki.type and loki.limit for Loki.
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.