> ## 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.

# High Byte Data

> Client-mode REST API connectors for HighByte Intelligence Hub: read connection inputs and modeled instances, write MQTT values to hub outputs and call API-trigger pipelines through the REST Data Server, and check hub info, connection health and project export / merge through the Configuration API

Technical Preview

## Overview

Client-mode REST API connectors for HighByte Intelligence Hub: read connection inputs and modeled instances, write MQTT values to hub outputs and call API-trigger pipelines through the REST Data Server, and check hub info, connection health and project export / merge through the Configuration API.

This is one of the templates in the HighByte Intelligence Hub REST API app (`highbyte-intelligence-hub`). 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: Bearer {value.json.api_key}`.

## Template parameters

| Placeholder | Type | Description | Required |
| - | - | - | - |
| `RouteName` | string | Name of the High Byte Data connector | no |
| `BaseUrl` | string | High Byte Data base URL without trailing slash (e.g. http\://YOUR\_HIGHBYTE\_HOST:8885) | yes |

`BASE_ADDRESS` default: `http://YOUR_HIGHBYTE_HOST:8885`.

## Events

| Event | Method | Endpoint | Request topic | Response topic | Payload fields |
| - | - | - | - | - | - |
| `ListConnections` | GET | `/data/v1/connections` | `historian/highbyte/connection/list` | `historian/highbyte/connection/list/response` | `api_key` |
| `ListInputs` | GET | `/data/v1/connections/{value.json.connection}/inputs` | `historian/highbyte/input/list` | `historian/highbyte/input/list/response` | `api_key`, `connection` |
| `GetInput` | GET | `/data/v1/connections/{value.json.connection}/inputs/{value.json.input}` | `historian/highbyte/input/get` | `historian/highbyte/input/get/response` | `api_key`, `connection`, `input` |
| `ReadInput` | GET | `/data/v1/connections/{value.json.connection}/inputs/{value.json.input}/value` | `historian/highbyte/input-value/get` | `historian/highbyte/input-value/get/response` | `api_key`, `connection`, `input` |
| `ReadInputWithParams` | POST | `/data/v1/connections/{value.json.connection}/inputs/{value.json.input}/value` | `historian/highbyte/input-value/read` | `historian/highbyte/input-value/read/response` | `api_key`, `body`, `connection`, `input` |
| `ListOutputs` | GET | `/data/v1/connections/{value.json.connection}/outputs` | `historian/highbyte/output/list` | `historian/highbyte/output/list/response` | `api_key`, `connection` |
| `WriteOutput` | POST | `/data/v1/connections/{value.json.connection}/outputs/{value.json.output}/value` | `historian/highbyte/output-value/write` | `historian/highbyte/output-value/write/response` | `api_key`, `body`, `connection`, `output` |
| `ListModels` | GET | `/data/v1/models` | `historian/highbyte/model/list` | `historian/highbyte/model/list/response` | `api_key` |
| `ListInstances` | GET | `/data/v1/instances` | `historian/highbyte/instance/list` | `historian/highbyte/instance/list/response` | `api_key` |
| `GetInstance` | GET | `/data/v1/instances/{value.json.instance}` | `historian/highbyte/instance/get` | `historian/highbyte/instance/get/response` | `api_key`, `instance` |
| `ReadInstance` | GET | `/data/v1/instances/{value.json.instance}/value` | `historian/highbyte/instance-value/get` | `historian/highbyte/instance-value/get/response` | `api_key`, `instance` |
| `ReadInstanceWithParams` | POST | `/data/v1/instances/{value.json.instance}/value` | `historian/highbyte/instance-value/read` | `historian/highbyte/instance-value/read/response` | `api_key`, `body`, `instance` |
| `ListPipelines` | GET | `/data/v1/pipelines` | `historian/highbyte/pipeline/list` | `historian/highbyte/pipeline/list/response` | `api_key` |
| `ListPipelineParams` | GET | `/data/v1/pipelines/params` | `historian/highbyte/pipeline-param/list` | `historian/highbyte/pipeline-param/list/response` | `api_key` |
| `GetPipelineParams` | GET | `/data/v1/pipelines/{value.json.pipeline}/params` | `historian/highbyte/pipeline-param/get` | `historian/highbyte/pipeline-param/get/response` | `api_key`, `pipeline` |
| `CallPipeline` | POST | `/data/v1/pipelines/{value.json.pipeline}/value` | `historian/highbyte/pipeline/call` | `historian/highbyte/pipeline/call/response` | `api_key`, `body`, `pipeline` |

## 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 HIGH_BYTE_DATA"
```

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 HighByteData WITH TYPE REST_API
    ADD REST_API_CONFIG
        WITH BASE_ADDRESS "http://YOUR_HIGHBYTE_HOST:8885"
        WITH ENABLE_CLIENT "true"
        WITH USE_SSL "false"
        WITH REQUEST_TIMEOUT '30'
        WITH DEFAULT_CONTENT_TYPE "application/json"
    ADD EVENT ListConnections
        WITH SOURCE_TOPIC "historian/highbyte/connection/list"
        WITH DESTINATION_TOPIC "historian/highbyte/connection/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/data/v1/connections"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_key}"
    ADD EVENT ListInputs
        WITH SOURCE_TOPIC "historian/highbyte/input/list"
        WITH DESTINATION_TOPIC "historian/highbyte/input/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/data/v1/connections/{value.json.connection}/inputs"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_key}"
    ADD EVENT GetInput
        WITH SOURCE_TOPIC "historian/highbyte/input/get"
        WITH DESTINATION_TOPIC "historian/highbyte/input/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/data/v1/connections/{value.json.connection}/inputs/{value.json.input}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_key}"
    ADD EVENT ReadInput
        WITH SOURCE_TOPIC "historian/highbyte/input-value/get"
        WITH DESTINATION_TOPIC "historian/highbyte/input-value/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/data/v1/connections/{value.json.connection}/inputs/{value.json.input}/value"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_key}"
    ADD EVENT ReadInputWithParams
        WITH SOURCE_TOPIC "historian/highbyte/input-value/read"
        WITH DESTINATION_TOPIC "historian/highbyte/input-value/read/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/data/v1/connections/{value.json.connection}/inputs/{value.json.input}/value"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.api_key}"
        WITH BODY "{value.json.body}"
    ADD EVENT ListOutputs
        WITH SOURCE_TOPIC "historian/highbyte/output/list"
        WITH DESTINATION_TOPIC "historian/highbyte/output/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/data/v1/connections/{value.json.connection}/outputs"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_key}"
    ADD EVENT WriteOutput
        WITH SOURCE_TOPIC "historian/highbyte/output-value/write"
        WITH DESTINATION_TOPIC "historian/highbyte/output-value/write/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/data/v1/connections/{value.json.connection}/outputs/{value.json.output}/value"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.api_key}"
        WITH BODY "{value.json.body}"
    ADD EVENT ListModels
        WITH SOURCE_TOPIC "historian/highbyte/model/list"
        WITH DESTINATION_TOPIC "historian/highbyte/model/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/data/v1/models"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_key}"
    ADD EVENT ListInstances
        WITH SOURCE_TOPIC "historian/highbyte/instance/list"
        WITH DESTINATION_TOPIC "historian/highbyte/instance/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/data/v1/instances"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_key}"
    ADD EVENT GetInstance
        WITH SOURCE_TOPIC "historian/highbyte/instance/get"
        WITH DESTINATION_TOPIC "historian/highbyte/instance/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/data/v1/instances/{value.json.instance}"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_key}"
    ADD EVENT ReadInstance
        WITH SOURCE_TOPIC "historian/highbyte/instance-value/get"
        WITH DESTINATION_TOPIC "historian/highbyte/instance-value/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/data/v1/instances/{value.json.instance}/value"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_key}"
    ADD EVENT ReadInstanceWithParams
        WITH SOURCE_TOPIC "historian/highbyte/instance-value/read"
        WITH DESTINATION_TOPIC "historian/highbyte/instance-value/read/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/data/v1/instances/{value.json.instance}/value"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.api_key}"
        WITH BODY "{value.json.body}"
    ADD EVENT ListPipelines
        WITH SOURCE_TOPIC "historian/highbyte/pipeline/list"
        WITH DESTINATION_TOPIC "historian/highbyte/pipeline/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/data/v1/pipelines"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_key}"
    ADD EVENT ListPipelineParams
        WITH SOURCE_TOPIC "historian/highbyte/pipeline-param/list"
        WITH DESTINATION_TOPIC "historian/highbyte/pipeline-param/list/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/data/v1/pipelines/params"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_key}"
    ADD EVENT GetPipelineParams
        WITH SOURCE_TOPIC "historian/highbyte/pipeline-param/get"
        WITH DESTINATION_TOPIC "historian/highbyte/pipeline-param/get/response"
        WITH METHOD "GET"
        WITH ENDPOINT "/data/v1/pipelines/{value.json.pipeline}/params"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Authorization" "Bearer {value.json.api_key}"
    ADD EVENT CallPipeline
        WITH SOURCE_TOPIC "historian/highbyte/pipeline/call"
        WITH DESTINATION_TOPIC "historian/highbyte/pipeline/call/response"
        WITH METHOD "POST"
        WITH ENDPOINT "/data/v1/pipelines/{value.json.pipeline}/value"
        WITH HEADERS
            ADD "Accept" "application/json"
            ADD "Content-Type" "application/json"
            ADD "Authorization" "Bearer {value.json.api_key}"
        WITH BODY "{value.json.body}"
```

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

## Usage example

Call `ListConnections` 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/highbyte/connection/list/response' &
mosquitto_pub -t 'historian/highbyte/connection/list' -m '{"api_key": "<api_key>"}'
```

## 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.