Skip to content

Query Template

POST
/v2/template/query/{template_id}
curl --request POST \
--url http://localhost:3000/v2/template/query/example \
--header 'Content-Type: application/json' \
--data '{ "id": "api.query.template.query", "ver": "v2", "ts": "2024-04-10T16:10:50+05:30", "params": { "msgid": "4a7f14c3-d61e-4d4f-be78-181834eeff6d" }, "request": { "startdate": "2020-12-31", "enddate": "2024-12-31", "aggregationLevel": "month", "dataset": "test", "limit": 5 } }'
template_id
required
string

Unique identifier for the template

Media type application/json
object
Example
{
"id": "api.query.template.query",
"ver": "v2",
"ts": "2024-04-10T16:10:50+05:30",
"params": {
"msgid": "4a7f14c3-d61e-4d4f-be78-181834eeff6d"
},
"request": {
"startdate": "2020-12-31",
"enddate": "2024-12-31",
"aggregationLevel": "month",
"dataset": "test",
"limit": 5
}
}

OK

Media type application/json
object
Examples

Success: JSON template with request body

{
"id": "api.query.template.query",
"ver": "v2",
"ts": "2024-05-14T11:52:24+05:30",
"params": {
"status": "SUCCESS",
"msgid": "4a7f14c3-d61e-4d4f-be78-181834eeff6d",
"resmsgid": "b65e0130-5ba4-49f1-bc6a-8a7d66d1a02d"
},
"responseCode": "OK",
"result": [
{
"timestamp": "2023-09-01T00:00:00.000Z",
"result": {
"school_id": 0
}
}
]
}
X-Powered-By
string
Example
Express
Content-Length
integer
Example
301
ETag
string
Example
W/"12d-9hKB38iHEwYPT2MgF8puXcq05Ew"
Date
string
Example
Tue, 14 May 2024 06:22:24 GMT
Connection
string
Example
keep-alive
Keep-Alive
string
Example
timeout=5

Bad Request

Media type application/json
object
Examples

Failure: invalid date range (native template)

{
"id": "api.query.template.query",
"ver": "v2",
"ts": "2024-05-02T12:59:14+05:30",
"params": {
"status": "FAILED",
"resmsgid": "4379e16b-2fa3-46a8-8ded-bc53f56283e9"
},
"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
336
ETag
string
Example
W/"150-T/XeSIt7PR7GcGEbET1e8n9zX7k"
Date
string
Example
Thu, 02 May 2024 07:29:14 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 druid

{
"id": "api.query.template.query",
"ver": "v2",
"ts": "2024-05-13T13:21:46+05:30",
"params": {
"status": "FAILED",
"msgid": "4a7f14c3-d61e-4d4f-be78-181834eeff6d",
"resmsgid": "b35a7050-b94c-4944-9630-233c9542272e"
},
"responseCode": "NOT_FOUND",
"error": {
"code": "DATA_OUT_SOURCE_NOT_FOUND",
"message": "Dataset test with table hour is not available for querying",
"trace": ""
}
}
X-Powered-By
string
Example
Express
Content-Length
integer
Example
357
ETag
string
Example
W/"165-Q7Qi9SUmHUwU75fy/RFrXL9Pp3U"
Date
string
Example
Mon, 13 May 2024 07:51:46 GMT
Connection
string
Example
keep-alive
Keep-Alive
string
Example
timeout=5