YAML Import API
The Streams Engine supports importing stream configurations from YAML format, providing a more human-readable alternative to JSON for defining complex streams.
Create Stream from YAML
Creates a new stream processing pipeline from a YAML definition.
Endpoint
POST /stream/streams/yaml
Request Body
The request body should be a YAML string with the following structure:
---
id: e795dc27-8da2-42e8-8d3b-50e5e4ff9943
meta:
name: Testing creation of a stream from API
nodes:
- id: 64cb7ca2-ebca-4502-8fc4-208fa90545f1
type: EXECUTABLE_PRODUCER
executable: node /usr/share/engines/worker-scripts/SignalGenerator.ts
config:
sampleRate: 1000
amplitudes:
- 5
- 5
- 5
frequencies:
- 1
- 60
- 100
- id: 64cb7ca2-ebca-4502-8fc4-208fa90545f3
type: EXECUTABLE_CONSUMER
executable: node /usr/share/engines/worker-scripts/WebSocket.ts
config:
port: 8088
pipes:
- id: 67a7a083-28b0-4dd5-b33d-e60e339bb93a
source: 64cb7ca2-ebca-4502-8fc4-208fa90545f1
destination: 64cb7ca2-ebca-4502-8fc4-208fa90545f3
Response
{
"id": "e795dc27-8da2-42e8-8d3b-50e5e4ff9943",
"success": true
}
Add Pipes from YAML
Adds one or more pipes to an existing stream using YAML format.
Endpoint
POST /stream/streams/{id}/pipes/yaml
Path Parameters
Parameter | Type | Description |
---|---|---|
id | String | Unique identifier of the stream |
Request Body
The request body should be a YAML string with pipe definitions:
---
- id: 425ce7ec-a7af-497a-8d67-6371a32ad8bb
source: 64cb7ca2-ebca-4502-8fc4-208fa90545f1
destination: 64cb7ca2-ebca-4502-8fc4-208fa90545f4
Response
{
"id": "425ce7ec-a7af-497a-8d67-6371a32ad8bb",
"pipes": ["67a7a083-28b0-4dd5-b33d-e60e339bb93z"],
"success": true
}
Using YAML for stream definitions provides a more human-readable alternative to JSON, especially for complex configurations with many nodes and pipes.