# How to run curl command

**URL:** https://discourse.nodered.org/t/how-to-run-curl-command/95930
**Category:** General
**Created:** [11 March 2025 20:29 UTC](https://discourse.nodered.org/t/how-to-run-curl-command/95930 "2025-03-11T20:29:03Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![MKaiser96](https://avatars.discourse-cdn.com/v4/letter/m/8c91f0/32.png) [@MKaiser96](https://discourse.nodered.org/u/MKaiser96)
#### Post date: [11 March 2025 20:29 UTC](https://discourse.nodered.org/t/how-to-run-curl-command/95930/1 "2025-03-11T20:29:03Z")

</div>

Hello,

I'm newly log my datapoints with InfluxDB. I want to create a template to delete datapoints via the InfluxDB API. There is a curl command to delete datapoints, but I don't know how to run this command in Node-RED.

Here is an example of the InfluxDB documentation.

```auto
curl --request POST http://localhost:8086/api/v2/delete?org=example-org&bucket=example-bucket \
  --header 'Authorization: Token YOUR_API_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{
    "start": "2020-03-01T00:00:00Z",
    "stop": "2020-11-14T00:00:00Z",
    "predicate": "_measurement=\"example-measurement\" AND exampleTag=\"exampleTagValue\""
  }'

```

Can someone please help me to get this command to work in Node-RED?

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [11 March 2025 20:35 UTC](https://discourse.nodered.org/t/how-to-run-curl-command/95930/2 "2025-03-11T20:35:44Z")

</div>

You can run the curl request in the http request node as a post request. Setting the headers in the request node, or passed to the request node in msg.headers. The data would be passed to the request node using msg.payload.  
Have a go and if you run into trouble you can post here an export of the flow that is not working. [How to import/export a flow](https://nodered.org/docs/user-guide/editor/workspace/import-export)

---

<div class="post-metadata">

### Author: ![MKaiser96](https://avatars.discourse-cdn.com/v4/letter/m/8c91f0/32.png) [@MKaiser96](https://discourse.nodered.org/u/MKaiser96)
#### Post date: [11 March 2025 20:43 UTC](https://discourse.nodered.org/t/how-to-run-curl-command/95930/3 "2025-03-11T20:43:47Z")

</div>

I got it! Thank you!

Here is my function node for http request node:

```auto
msg.method = "POST" 
msg.url = 'http://localhost:8086/api/v2/delete?org=example-org&bucket=example-bucket'

msg.headers = {
    "Authorization": "Token YOUR_API_TOKEN",              
    "Content-Type": "application/json"
}

msg.payload = {
    "start": "2020-03-01T00:00:00Z",
    "stop": "2020-11-14T00:00:00Z",
    "predicate": "_measurement=\"example-measurement\" AND exampleTag=\"exampleTagValue\""
}

return msg;

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [25 March 2025 20:44 UTC](https://discourse.nodered.org/t/how-to-run-curl-command/95930/4 "2025-03-25T20:44:14Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
