Delete data of influxDB by Node Red

Hi,

I would like to delete data of influxDB.
I try to use curl method.
I can use post man to run curl to delete data.
However, it is error when i use http request node in Node Red. Any idea? Thank you for your help.

It is error message of debug node in Node Red.
"{"code":"invalid","message":"error decoding json body: Invalid delete predicate node request: json: cannot unmarshal number into Go value of type http.deleteRequestDecode"}"

It is url field in http request node:

http://XX.XXX.XXX.XX:8086/api/v2/delete?bucket=goalgobike&org=YYYYY
--header 'Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
--header 'Accept: application/json'
--header 'Content-Type: application/json'
--data '{
"start": "2000-10-20T16:00:00.000Z",
"stop": "2031-10-20T17:00:00.000Z",
"predicate": "_measurement=bike2id",
}'

Welcome to the forum.
Show us the curl command that works.

Hi Colin,

Thank you for your help.
Luckily, i found the solution now. I seperate data part (json), just keep header and url in http respose node, it works now.

The name of "button node" is "delete", the left hand side node in blue. i put json data in payload of this node.


This is http request node.

Between, i also want clarify the root cause of problem. Can i put all curl command in http request node?
Here is my curl command in post man:
curl --location 'XX.XXX.XXX.XX:8086/api/v2/delete?bucket=goalgobike&org=YYYYYYYYY'
--header 'Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
--header 'Accept: application/json'
--header 'Content-Type: application/json'
--data '{
"start": "2000-10-20T16:00:00.000Z",
"stop": "2031-10-20T17:00:00.000Z",
"predicate": "_measurement=bike2id"
}'

The way you have done it is the normal way for a POST.

I don't think that you can encode header data in the url.

1 Like