> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreflux.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Node Red Http In

> Client-mode REST API connectors for Node-RED and FlowFuse: read and deploy Node-RED flows through the Admin API, start and stop flows, read context, manage node modules, send MQTT data to your own HTTP In endpoints, and manage FlowFuse teams, applications, hosted instances, snapshots and devices from MQTT

Technical Preview

## Overview

Client-mode REST API connectors for Node-RED and FlowFuse: read and deploy Node-RED flows through the Admin API, start and stop flows, read context, manage node modules, send MQTT data to your own HTTP In endpoints, and manage FlowFuse teams, applications, hosted instances, snapshots and devices from MQTT.

This is one of the templates in the Node-RED (Admin API, HTTP In nodes) and FlowFuse REST API app (`node-red-and-flowfuse`). Deploy it alongside the other connectors of that app when they depend on each other (for example a token connector plus an API connector).

## Auth

Auth headers used by the template: `Authorization: Basic {value.json.basic}`, `Authorization: Bearer {value.json.token}`.

## Template parameters

| Placeholder | Type | Description | Required |
| - | - | - | - |
| `RouteName` | string | Name of the Node Red Http In connector | no |
| `BaseUrl` | string | Node Red Http In base URL without trailing slash (e.g. http\://YOUR\_NODE\_RED\_HOST:1880) | yes |

`BASE_ADDRESS` default: `http://YOUR_NODE_RED_HOST:1880`.

## Events

| Event | Method | Endpoint | Request topic | Response topic | Payload fields |
| - | - | - | - | - | - |
| `HttpInPost` | POST | `/{value.json.path}` | `historian/node-red-http/endpoint/post` | `historian/node-red-http/endpoint/post/response` | `body`, `path` |
| `HttpInGet` | GET | `/{value.json.path}` | `historian/node-red-http/endpoint/get` | `historian/node-red-http/endpoint/get/response` | `path` |
| `HttpInPut` | PUT | `/{value.json.path}` | `historian/node-red-http/endpoint/put` | `historian/node-red-http/endpoint/put/response` | `body`, `path` |
| `HttpInPostBearer` | POST | `/{value.json.path}` | `historian/node-red-http/secure-endpoint/post` | `historian/node-red-http/secure-endpoint/post/response` | `body`, `path`, `token` |
| `HttpInGetBearer` | GET | `/{value.json.path}` | `historian/node-red-http/secure-endpoint/get` | `historian/node-red-http/secure-endpoint/get/response` | `path`, `token` |
| `HttpInPostBasic` | POST | `/{value.json.path}` | `historian/node-red-http/basic-endpoint/post` | `historian/node-red-http/basic-endpoint/post/response` | `basic`, `body`, `path` |
| `HttpInGetBasic` | GET | `/{value.json.path}` | `historian/node-red-http/basic-endpoint/get` | `historian/node-red-http/basic-endpoint/get/response` | `basic`, `path` |
| `HttpInDelete` | DELETE | `/{value.json.path}` | `historian/node-red-http/endpoint/delete` | `historian/node-red-http/endpoint/delete/response` | `path` |

## Deploy

Get the template card (JSON with `template` and `metadata`) from the broker, then deploy the connector:

```bash theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
mosquitto_pub -t '$SYS/Coreflux/Command' -m "-routeCode NODE_RED_HTTP_IN"
```

The deployable connector from the REST API app, with `BASE_ADDRESS` already filled in:

```lot theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
DEFINE ROUTE NodeRedHttpIn WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "http://YOUR_NODE_RED_HOST:1880"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "false"
        WITH REQUEST_TIMEOUT '30'
        WITH DEFAULT_CONTENT_TYPE "application/json"
    ADD EVENT HttpInPost
        WITH SOURCE_TOPIC "historian/node-red-http/endpoint/post"
        WITH DESTINATION_TOPIC "historian/node-red-http/endpoint/post/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/{value.json.path}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT HttpInGet
        WITH SOURCE_TOPIC "historian/node-red-http/endpoint/get"
        WITH DESTINATION_TOPIC "historian/node-red-http/endpoint/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/{value.json.path}"
        WITH HEADERS
            ADD "Accept" "application/json"
    ADD EVENT HttpInPut
        WITH SOURCE_TOPIC "historian/node-red-http/endpoint/put"
        WITH DESTINATION_TOPIC "historian/node-red-http/endpoint/put/response"
        WITH METHOD "PUT"
        WITH ENDPOINT "/{value.json.path}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
        WITH BODY "{value.json.body}"
    ADD EVENT HttpInPostBearer
        WITH SOURCE_TOPIC "historian/node-red-http/secure-endpoint/post"
        WITH DESTINATION_TOPIC "historian/node-red-http/secure-endpoint/post/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/{value.json.path}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
        WITH BODY "{value.json.body}"
    ADD EVENT HttpInGetBearer
        WITH SOURCE_TOPIC "historian/node-red-http/secure-endpoint/get"
        WITH DESTINATION_TOPIC "historian/node-red-http/secure-endpoint/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/{value.json.path}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.token}"
    ADD EVENT HttpInPostBasic
        WITH SOURCE_TOPIC "historian/node-red-http/basic-endpoint/post"
        WITH DESTINATION_TOPIC "historian/node-red-http/basic-endpoint/post/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/{value.json.path}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Basic {value.json.basic}"
        WITH BODY "{value.json.body}"
    ADD EVENT HttpInGetBasic
        WITH SOURCE_TOPIC "historian/node-red-http/basic-endpoint/get"
        WITH DESTINATION_TOPIC "historian/node-red-http/basic-endpoint/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/{value.json.path}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Basic {value.json.basic}"
    ADD EVENT HttpInDelete
        WITH SOURCE_TOPIC "historian/node-red-http/endpoint/delete"
        WITH DESTINATION_TOPIC "historian/node-red-http/endpoint/delete/response"
        WITH METHOD "DELETE"
        WITH ENDPOINT "/{value.json.path}"
        WITH HEADERS
            ADD "Accept" "application/json"
```

Deploy it with `-addRoute` (do not include `ADD METADATA`).

## Usage example

Call `HttpInPost` by publishing a JSON payload to its request topic, and read the reply on the response topic:

```bash theme={"theme":"css-variables","languages":{"custom":["/languages/lot.json"]}}
mosquitto_sub -t 'historian/node-red-http/endpoint/post/response' &
mosquitto_pub -t 'historian/node-red-http/endpoint/post' -m '{"body": {}, "path": "<path>"}'
```

## Related

* [REST API Connectors](/latest/lot-language/routes/rest-api-routes)
* [REST API Apps catalog](/latest/lot-language/routes/rest-api-apps)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.