Flow
Resource Group ¶
Flows ¶
Get the current configured flowsGET/v1/flow
Returns all currently configured flows
Example URI
Headers
Content-Type: application/json; charset=utf-8
Authorization: Bearer JWT
200
Headers
Content-Type: application/json; charset=utf-8
Body
{
"flows": [
{
"name": "firstflow",
"enabled": true,
"id": "123456",
"flow": [],
"created": 1538070858845,
"updated": 1538070858845
}
]
}
500
Headers
Content-Type: application/json; charset=utf-8
Body
{
"message": "Failed to list flows" | "Failed to switch tenancy context"
}
Configure a new flowPOST/v1/flow
Adds a new flow.
Example URI
Headers
Content-Type: application/json; charset=utf-8
Authorization: Bearer JWT
Body
{
"flow": [],
"enabled": true,
"name": "secondflow"
}
200
Headers
Content-Type: application/json; charset=utf-8
Body
{
"message": "ok",
"flow": {
"name": "secondflow",
"enabled": true,
"id": "123457",
"flow": [],
"created": 1538070858845,
"updated": 1538070858845
}
}
400
Headers
Content-Type: application/json; charset=utf-8
Body
{
"message": "Missing mandatory field"
}
500
Headers
Content-Type: application/json; charset=utf-8
Body
{
"message" : "failed to create flow" | "Failed to switch tenancy context"
}
Removes all flowsDELETE/v1/flow
Removes all flows and their configurations.
Example URI
Headers
Content-Type: application/json; charset=utf-8
Authorization: Bearer JWT
200
Headers
Content-Type: application/json; charset=utf-8
Body
{
"message": "All flows removed"
}
500
Headers
Content-Type: application/json; charset=utf-8
Body
{
"message" : "Failed to remove flows" | "Failed to switch tenancy context"
}
Specific Flow ¶
Get the current configured flowGET/v1/flow/{id}
Returns the configuration of a particular flow
Example URI
- id
string
(required) Example: 123456The identifier associated to the flow
Headers
Content-Type: application/json; charset=utf-8
Authorization: Bearer JWT
200
Headers
Content-Type: application/json; charset=utf-8
Body
{
"message": "ok",
"flow": {
"name": "firstflow",
"enabled": true,
"id": "123456",
"flow": [],
"created": 1538070858845,
"updated": 1538070858845
}
}
500
Body
{
"msg" : "Failed to get flow" | "Failed to switch tenancy context"
}
404
Body
{
"message": "Unknown flow: 123456",
"flow": "123456"
}
Reconfigure a specific flowPUT/v1/flow/{id}
Reconfigure a particular flow - the old configuration will be removed and the new one will be deployed.
Example URI
- id
string
(required) Example: 123456The identifier associated to the flow
Headers
Content-Type: application/json; charset=utf-8
Authorization: Bearer JWT
Body
{
"name": "newflowname",
"enabled": true,
"flow": []
}
200
Headers
Content-Type: application/json; charset=utf-8
Body
{
"message": "ok",
"flow": {
"name": "newflowname",
"enabled": true,
"id": "123456",
"flow": [],
"created": 1538070858845,
"updated": 1538070858845
}
}
404
Body
{
"message": "Unknown flow: 123456",
"flow": "123456"
}
500
Body
{
"msg" : "failed to update flows" | "Failed to switch tenancy context"
}
Remove the flowDELETE/v1/flow/{id}
Removes the flow and its configuration.
Example URI
- id
string
(required) Example: 123456The identifier associated to the flow
Headers
Content-Type: application/json; charset=utf-8
Authorization: Bearer JWT
200
Body
{
"message": "flow removed",
"flow": {
"name": "firstflow",
"enabled": true,
"id": "123456",
"flow": [],
"created": 1538070858845,
"updated": 1538070858845
}
}
500
Body
{
"msg" : "failed to remove flow" | "Failed to switch tenancy context"
}
404
Body
{
"message": "Unknown flow: 777777",
"flow": "777777"
}
Nodes ¶
Add a remote nodePOST/v1/node
Adds a remote node
Example URI
Headers
Content-Type: application/json; charset=utf-8
Authorization: Bearer JWT
Body
{
"image": "dojot/kelvin-example:v0.5",
"id": "kelvin"
}
200
Headers
Content-Type: application/json; charset=utf-8
Body
{
"message": "ok"
}
400
Body
{
"message" : "Missing mandatory field" | "Given flow is invalid"
}
500
Body
{
"message": "Failed to add node"
}
Retrieve all remote nodesGET/v1/node
Retrieve all currently running remote nodes
Example URI
Headers
Content-Type: application/json; charset=utf-8
Authorization: Bearer JWT
200
Headers
Content-Type: application/json; charset=utf-8
Body
{
"nodes": [
{
"id": "kelvin",
"image": "raulnegreiros/kelvin:latest"
}
]
}
500
Headers
Content-Type: application/json; charset=utf-8
Body
{
"message": "Failed list nodes",
}
Remove a remote nodeDELETE/v1/node/{id}
Removes a remote node
Example URI
- id
string
(required) Example: kelvinThe identifier associated to the node
Headers
Content-Type: application/json; charset=utf-8
Authorization: Bearer JWT
200
Headers
Content-Type: application/json; charset=utf-8
Body
{
"message": "ok"
}
500
Body
{
"message": "failed to remove node."
}
Remove all remote nodesDELETE/v1/node
Removes a remote node
Example URI
Headers
Content-Type: application/json; charset=utf-8
Authorization: Bearer JWT
200
Headers
Content-Type: application/json; charset=utf-8
Body
{
"message": "ok"
}
500
Headers
Content-Type: application/json; charset=utf-8
Body
{
"message": "failed to remove node."
}
NodeRED nodes ¶
Retrieve all nodesGET/nodes
The request can be sent with “Accept: application/json” header, which will generate a JSON object with a list of all nodes currently configured in Flowbroker. It can also be set with “Accept: text/html”. In this case, a huge HTML file is returned with all nodes HTML description and associated scripts so that it can be rendered in a frontend application (it will be composed by all HTML files associated to each node).
Example URI
for node JSON description
Headers
Authorization: Bearer JWT
Accept: application/json
200
Headers
Content-Type: application/json; charset=utf-8
Body
[
{
"id": "dojot/change",
"name": "change",
"module": "dojot",
"version": "1.0.0",
"enabled": true,
"local": true,
"types": [
"change"
]
}
]
for node HTML
Headers
Authorization: Bearer JWT
Accept: text/html
200
Headers
Content-Type: text/html; charset=utf-8
Body
<script type="text/x-red" data-template-name="change"></script>
<script type="text/x-red" data-help-name="change"></script>
<script type="text/javascript">
RED.nodes.registerType('change', {
color: "#E2D96E",
category: 'function',
defaults: {
name: {value: ""},
rules: {value: [{t: "set", p: "payload", pt: "msg", to: "", tot: "str"}]},
// legacy
action: {value: ""},
property: {value: ""},
from: {value: ""},
to: {value: ""},
reg: {value: false}
},
....
});
</script>
NodeRED localization strings ¶
Retrieve localization strings for node-red nodesGET/locales/node-red
Example URI
Headers
Authorization: Bearer JWT
200
Headers
Content-Type: application/json; charset=utf-8
Body
{
"common": {
"label": {
"payload": "Payload",
"topic": "Topic",
"name": "Name",
"username": "Username"
}
}
}