Skip to content

Query Data

POST
/v2/data/query/{dataset_id}
curl --request POST \
--url http://localhost:3000/v2/data/query/example \
--header 'Content-Type: application/json' \
--data '{ "id": "api.data.out", "ver": "v2", "ts": "1711966306164", "params": { "msgid": "e180ecac-8f41-4f21-9a21-0b3a1a368917" }, "context": { "aggregationLevel": "day" }, "query": "Select * from \"check\" WHERE __time >= timestamp '\''2020-12-31'\'' AND __time < TIMESTAMP '\''2024-01-21'\'' Limit 1" }'
dataset_id
required
string

Unique identifier for the dataset

Media type application/json
object
Example
{
"id": "api.data.out",
"ver": "v2",
"ts": "1711966306164",
"params": {
"msgid": "e180ecac-8f41-4f21-9a21-0b3a1a368917"
},
"context": {
"aggregationLevel": "day"
},
"query": "Select * from \"check\" WHERE __time >= timestamp '2020-12-31' AND __time < TIMESTAMP '2024-01-21' Limit 1"
}

OK

Media type application/json
object
Examples

Success: native query (interval as array type)

{
"id": "api.data.out",
"ver": "v2",
"ts": "2024-05-30T23:47:45+05:30",
"params": {
"status": "SUCCESS",
"msgid": "e180ecac-8f41-4f21-9a21-0b3a1a368917",
"resmsgid": "134efe35-c096-4cab-ad14-db6a8952f264"
},
"responseCode": "OK",
"result": [
{
"timestamp": "2023-09-11T00:00:00.000Z",
"result": {
"a1": 1694390400000,
"a0": 1694390400000
}
}
]
}
X-Powered-By
string
Example
Express
Content-Length
integer
Example
313
ETag
string
Example
W/"139-De+IthAwrGNR+J11CwlNf5RSMmw"
Date
string
Example
Thu, 30 May 2024 18:17:45 GMT
Connection
string
Example
keep-alive
Keep-Alive
string
Example
timeout=5

Bad Request

Media type application/json
object
Example
{
"id": "api.data.out",
"ver": "v2",
"ts": "2024-05-30T23:46:29+05:30",
"params": {
"status": "FAILED",
"msgid": "e180ecac-8f41-4f21-9a21-0b3a1a368917",
"resmsgid": "b6434700-dd92-4f64-9250-a22939e753b9"
},
"responseCode": "BAD_REQUEST",
"result": {},
"error": {
"code": "DATA_OUT_INVALID_DATE_RANGE",
"message": "Invalid date range! make sure your range cannot be more than 30 days",
"trace": ""
}
}
X-Powered-By
string
Example
Express
Content-Length
integer
Example
371
ETag
string
Example
W/"173-OP8NcbSqLKFO92PIyUmMk0lNsXs"
Date
string
Example
Thu, 30 May 2024 18:16:29 GMT
Connection
string
Example
keep-alive
Keep-Alive
string
Example
timeout=5

Not Found

Media type application/json
object
Examples

Failure: Datasource not found in live table

{
"id": "api.data.out",
"ver": "v2",
"ts": "2024-05-30T23:43:12+05:30",
"params": {
"status": "FAILED",
"msgid": "e180ecac-8f41-4f21-9a21-0b3a1a368917",
"resmsgid": "f922f120-2aea-49af-9a76-7312fe2eb266"
},
"responseCode": "NOT_FOUND",
"result": {},
"error": {
"code": "DATA_OUT_SOURCE_NOT_FOUND",
"message": "Datasource telemetry-eventssss not available for querying",
"trace": ""
}
}
X-Powered-By
string
Example
Express
Content-Length
integer
Example
356
ETag
string
Example
W/"164-DSmPP0WJI5ISEqIw3U3B1NFXxVE"
Date
string
Example
Thu, 30 May 2024 18:13:12 GMT
Connection
string
Example
keep-alive
Keep-Alive
string
Example
timeout=5