Skip to content

Update Template

PATCH
/v2/template/update/{template_id}
curl --request PATCH \
--url http://localhost:3000/v2/template/update/example \
--header 'Content-Type: application/json' \
--data '{ "id": "api.query.template.update", "ver": "v2", "ts": "2024-04-10T16:10:50+05:30", "params": { "msgid": "4a7f14c3-d61e-4d4f-be78-181834eeff6d" }, "request": { "template_name": "sql_update_test_template", "query_type": "sql", "query": "SELECT * FROM {{DATASET}} WHERE __time BETWEEN TIMESTAMP {{STARTDATE}} AND TIMESTAMP {{ENDDATE}} lIMIT {{LIMIT}}" } }'
template_id
required
string

Unique identifier for the template

Media type application/json
object
Example
{
"id": "api.query.template.update",
"ver": "v2",
"ts": "2024-04-10T16:10:50+05:30",
"params": {
"msgid": "4a7f14c3-d61e-4d4f-be78-181834eeff6d"
},
"request": {
"template_name": "sql_update_test_template",
"query_type": "sql",
"query": "SELECT * FROM {{DATASET}} WHERE __time BETWEEN TIMESTAMP {{STARTDATE}} AND TIMESTAMP {{ENDDATE}} lIMIT {{LIMIT}}"
}
}

OK

Media type application/json
object
Example
{
"id": "api.query.template.update",
"ver": "v2",
"ts": "2024-05-10T11:21:47+05:30",
"params": {
"status": "SUCCESS",
"msgid": "4a7f14c3-d61e-4d4f-be78-181834eeff6d",
"resmsgid": "9e4a6959-0eb9-4fc4-8e6f-2eea534d1384"
},
"responseCode": "OK",
"result": {
"message": "Query template updated successfully",
"templateId": "sql11template1"
}
}
X-Powered-By
string
Example
Express
Content-Length
integer
Example
314
ETag
string
Example
W/"13a-jsb3kdb5RR9P3vnOhZWsAWEr37k"
Date
string
Example
Fri, 10 May 2024 05:51:47 GMT
Connection
string
Example
keep-alive
Keep-Alive
string
Example
timeout=5

Bad Request

Media type application/json
object
Examples

Failure: required variables not exists to update

{
"id": "api.query.template.update",
"ver": "v2",
"ts": "2024-05-10T11:23:54+05:30",
"params": {
"status": "FAILED",
"msgid": "4a7f14c3-d61e-4d4f-be78-181834eeff6d",
"resmsgid": "66b95cb3-2ef2-4735-9045-2674da552dbd"
},
"responseCode": "BAD_REQUEST",
"result": {},
"error": {
"code": "QUERY_TEMPLATE_INVALID_INPUT",
"message": "Invalid template provided, A template should consist of variables DATASET,STARTDATE,ENDDATE and type of json,sql",
"trace": ""
}
}
X-Powered-By
string
Example
Express
Content-Length
integer
Example
429
ETag
string
Example
W/"1ad-5sb8WUekFL8s4c1Ink6bUByoHho"
Date
string
Example
Fri, 10 May 2024 05:53:54 GMT
Connection
string
Example
keep-alive
Keep-Alive
string
Example
timeout=5