Skip to content

Create query template

POST
/v2/template/create
curl --request POST \
--url http://localhost:3000/v2/template/create \
--header 'Content-Type: application/json' \
--data '{ "id": "query.template.create", "ver": "v2", "ts": "2024-04-10T16:10:50+05:30", "params": { "msgid": "4a7f14c3-d61e-4d4f-be78-181834eeff6d" }, "request": { "query_type": "sql", "query": { "queryType": "select", "datasetId": "{{DATASET}}", "intervals": "{{STARTDATE}}/{{ENDDATE}}", "limit": "{{LIMITS}}" } } }'
Media type application/json
object
Example
{
"id": "query.template.create",
"ver": "v2",
"ts": "2024-04-10T16:10:50+05:30",
"params": {
"msgid": "4a7f14c3-d61e-4d4f-be78-181834eeff6d"
},
"request": {
"query_type": "sql",
"query": {
"queryType": "select",
"datasetId": "{{DATASET}}",
"intervals": "{{STARTDATE}}/{{ENDDATE}}",
"limit": "{{LIMITS}}"
}
}
}

OK

Media type application/json
object
Examples

Success : Create query template success (json)

{
"id": "api.query.template.create",
"ver": "v2",
"ts": "2024-04-29T22:29:01+05:30",
"params": {
"status": "SUCCESS",
"msgid": "4a7f14c3-d61e-4d4f-be78-181834eeff6d",
"resmsgid": "71372ce0-16b9-4594-8db8-f12eff7e6a42"
},
"responseCode": "OK",
"result": {
"template_id": "json11template",
"template_name": "json11template",
"message": "The query template has been saved successfully"
}
}
X-Powered-By
string
Example
Express
Content-Length
integer
Example
359
ETag
string
Example
W/"167-HIMd6+dVF/Wyu6lcmb/+68O4AY4"
Date
string
Example
Mon, 29 Apr 2024 16:59:01 GMT
Connection
string
Example
keep-alive
Keep-Alive
string
Example
timeout=5

Bad Request

Media type application/json
object
Examples

Failure: Missing required variables

{
"id": "api.query.template.create",
"ver": "v2",
"ts": "2024-04-29T22:35:10+05:30",
"params": {
"status": "FAILED",
"msgid": "4a7f14c3-d61e-4d4f-be78-181834eeff6d",
"resmsgid": "62e18342-7e25-4122-8fca-6fb12fac3ff0"
},
"responseCode": "BAD_REQUEST",
"result": {},
"error": {
"code": "QUERY_TEMPLATE_INVALID",
"message": "Invalid template provided, A template should consist of variables undefined and type of json,sql",
"trace": ""
}
}
X-Powered-By
string
Example
Express
Content-Length
integer
Example
407
ETag
string
Example
W/"197-y0n7/XzKhcV9HKqgPNj2eo8bzh8"
Date
string
Example
Mon, 29 Apr 2024 17:05:10 GMT
Connection
string
Example
keep-alive
Keep-Alive
string
Example
timeout=5

Conflict

Media type application/json
object
Example
{
"id": "api.query.template.create",
"ver": "v2",
"ts": "2024-04-29T22:33:28+05:30",
"params": {
"status": "FAILED",
"msgid": "4a7f14c3-d61e-4d4f-be78-181834eeff6d",
"resmsgid": "18b6b123-4df5-4124-b6ec-73b667250e1c"
},
"responseCode": "CONFLICT",
"result": {},
"error": {
"code": "QUERY_TEMPLATE_ALREADY_EXISTS",
"message": "Template josnaks-aaa already exists",
"trace": ""
}
}
X-Powered-By
string
Example
Express
Content-Length
integer
Example
350
ETag
string
Example
W/"15e-FDXFj2WIyZ1MVllwsiSJoBKU4GQ"
Date
string
Example
Mon, 29 Apr 2024 17:03:28 GMT
Connection
string
Example
keep-alive
Keep-Alive
string
Example
timeout=5