influxdata / influxdata/kapacitor
HTTP API create task with template-id not working
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
Hi Guys,
I'm testing the HTTP API for Kapacitor. I've noticed when trying to create a TASK from a template through the HTTP API for Kapacitor, it's not working as expected (or my expectations could be wrong).
As an example I have a database in influxdb called 'test' , I've also created a template called 'template test'
I create my template using the following script:
```
{"type": "stream",
"id": "test_template",
"script": "stream|from().measurement('cpu')"}
```
with response
```
{
"link": {
"rel": "self",
"href": "/kapacitor/v1/templates/test_template"
},
"id": "test_template",
"type": "stream",
"script": "stream\n |from()\n .measurement('cpu')\n",
"vars": {},
"dot": "digraph test_template {\nstream0 -> from1;\n}",
"error": "",
"created": "2016-11-07T11:05:42.550850093Z",
"modified": "2016-11-07T11:05:42.550850093Z"
}
```
After verifying my template is being created, I try to create a new task using this template again, using the task creation endpoint.
```
{
"status": "enabled",
"id": "test_task3",
"template-id": "test_template",
"dbrps": [
{
"db": "test",
"rp": "autogen"
}
],
"type": "stream"
}
```
The response I get is
```
{
"error": "must provide TICKscript"
}
```
My assumption is that if I'm using a template I wouldn't provide the TICK script as this has already been provided in the template.
If I do provide a Script I see that a task is created with the Script provided and not the template.
Contributor guide
Research direction
Start by reproducing the documented template-creation and task-creation HTTP API requests, then inspect the task creation endpoint's handling of template-id and the missing TICKscript error. Done means a task can be created from the supplied template without also providing a TICKscript, and the resulting task uses that template.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100