influxdata / influxdata/kapacitor
Defining Template using API gives error
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
I have encountered an issue while defining templates using the Kapacitor apis. Whenever I try to define a template, by doing a POST request, I get an error message with error code 400-Bad Request and the message-“template already exists”. I have tested this using Postman. I bring down the whole environment before starting and even used couple weird names just to be sure that I am not using any repetitive name, but the result remains the same.
The json I am sending for template is-
{
"id" : "Threshold_Template111115",
"type" : "stream",
"script": "// Which measurement to consume\nvar measurement string\n\nvar ABC lambda\n\nvar orgGroup lambda\n\nvar tenantId lambda\n\nvar where_filter = lambda: ABC AND orgGroup AND tenantId\n\n// Optional list of group by dimensions\nvar groups = [*]\n\n// Which field to process\nvar field string\n\n// Critical criteria\nvar crit lambda\n\nstream\n |from()\n .measurement(measurement)\n .where(where_filter)\n .groupBy(groups)\n |alert()\n .stateChangesOnly()\n .crit(crit)\n .tcp('localhost:80')\n"
}
Contributor guide
Research direction
Start by reproducing the POST request from the issue in Postman, using the supplied JSON and a unique template ID. Trace the template-definition API handling to determine why it reports an existing template, then verify that a new template can be defined successfully without the false 400 response.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100