Read Template
GET
/v2/template/read/{template_id}
const url = 'http://localhost:3000/v2/template/read/example';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url http://localhost:3000/v2/template/read/exampleParameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ” template_id
required
string
Unique identifier for the template
Responses
Section titled “ Responses ”OK
Media type application/json
object
Examples
Success: JSON template
{ "id": "api.query.template.read", "ver": "v2", "ts": "2024-05-30T23:54:14+05:30", "params": { "status": "SUCCESS", "resmsgid": "ad1c0a98-1ba3-4203-9fac-59ccaf442347" }, "responseCode": "OK", "result": { "template_id": "jsontemplate111", "template_name": "jsontemplate111", "query": "{\"queryType\":\"select\",\"datasetId\":\"{{DATASET}}\",\"intervals\":\"{{STARTDATE}}/{{ENDDATE}}\",\"limit\":\"{{LIMITS}}\"}", "query_type": "json", "created_by": "SYSTEM", "updated_by": "SYSTEM", "created_date": "2024-04-29T01:16:57.023Z", "updated_date": "2024-04-29T01:16:57.023Z" }}Success: SQL template
{ "id": "api.query.template.read", "ver": "v2", "ts": "2024-05-30T23:54:38+05:30", "params": { "status": "SUCCESS", "resmsgid": "70047866-a4b4-4fce-b9c4-4699fcab2dc6" }, "responseCode": "OK", "result": { "template_id": "sql1", "template_name": "sql1", "query": "\"SELECT COUNT(*) FROM \\\"{{DATASET}}\\\" WHERE \\\"__time\\\" BETWEEN TIMESTAMP {{STARTDATE}} AND TIMESTAMP {{ENDDATE}} lIMIT {{LIMIT}}\"", "query_type": "sql", "created_by": "SYSTEM", "updated_by": "SYSTEM", "created_date": "2024-05-13T07:29:04.117Z", "updated_date": "2024-05-13T07:29:04.117Z" }}Headers
Section titled “Headers ” X-Powered-By
string
Example
Express Content-Length
integer
Example
537 ETag
string
Example
W/"219-BOO8L4HgRkX4zEKoNwUwfDQA+uU" Date
string
Example
Thu, 30 May 2024 18:24:14 GMT Connection
string
Example
keep-alive Keep-Alive
string
Example
timeout=5Not Found
Media type application/json
object
Example
{ "id": "api.query.template.read", "ver": "v2", "ts": "2024-05-30T23:55:16+05:30", "params": { "status": "FAILED", "resmsgid": "958bf0e7-bdb8-4153-abdc-ab84e8004a0e" }, "responseCode": "NOT_FOUND", "result": {}, "error": { "code": "QUERY_TEMPLATE_NOT_EXISTS", "message": "Template sql100 does not exists", "trace": "" }}Headers
Section titled “Headers ” X-Powered-By
string
Example
Express Content-Length
integer
Example
294 ETag
string
Example
W/"126-zq5j1yor+xr1XFEEbP09fQTDI/k" Date
string
Example
Thu, 30 May 2024 18:25:16 GMT Connection
string
Example
keep-alive Keep-Alive
string
Example
timeout=5