Create Flow

POST /node/api/flows

Creates a new flow and returns its JSON representation.
Permissions: create-flows | manage-flows.

Request parameters

...

Response description

...

Examples

Request examples

Bash
JavaScript
NodeJS
Python
1
login=<...>
2
password=<...>
3
saymon_hostname=<...>
4
url=https://$saymon_hostname/node/api/flows
5
6
curl -X POST $url -u $login:$password \
7
-H "Content-Type: application/json" \
8
-d @- <<EOF
9
{
10
"owner_id": "1",
11
"item_ids": [
12
"5e3c15338d44b91b57eec165",
13
"5e3c151e8d44b91b57eec0c1",
14
"5e466ebf8d44b91b57f174f4"
15
]
16
}
17
EOF
Copied!
1
let login = <...>
2
let password = <...>
3
let saymonHostname = <...>
4
let path = "/node/api/flows";
5
let auth = "Basic " + btoa(login + ":" + password);
6
7
let headers = new Headers();
8
headers.append("Content-Type", "application/json");
9
headers.append("Authorization", auth);
10
11
let data = JSON.stringify({
12
"owner_id": "1",
13
"item_ids": [
14
"5e85e026a82a7421a9a3499b",
15
"5e860968a82a7421a9a34a88",
16
"5e86081aa82a7421a9a34a78"
17
]
18
});
19
20
let requestOptions = {
21
method: "POST",
22
headers: headers,
23
body: data
24
};
25
26
fetch(saymonHostname + path, requestOptions)
27
.then(response => response.text())
28
.then(result => console.log(result))
29
.catch(error => console.log("error", error));
Copied!
1
const http = require("http");
2
3
let login = <...>
4
let password = <...>
5
let saymonHostname = <...>
6
let path = "/node/api/flows";
7
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
8
9
let options = {
10
"method": "POST",
11
"hostname": saymonHostname,
12
"headers": {
13
"Authorization": auth,
14
"Content-Type": "application/json"
15
},
16
"path": path
17
};
18
19
let req = http.request(options, function (res) {
20
let chunks = [];
21
22
res.on("data", function (chunk) {
23
chunks.push(chunk);
24
});
25
26
res.on("end", function (chunk) {
27
let body = Buffer.concat(chunks);
28
console.log(body.toString());
29
});
30
31
res.on("error", function (error) {
32
console.error(error);
33
});
34
});
35
36
let data = JSON.stringify({
37
"owner_id": "1",
38
"item_ids": [
39
"5e4e84fa39438824a1046829",
40
"5e552961d4511026d723154d",
41
"5e6f477fd462c02529b06eb7"
42
]
43
});
44
45
req.write(data);
46
req.end();
Copied!
1
import requests
2
3
login = <...>
4
password = <...>
5
saymon_hostname = <...>
6
url = "https://" + saymon_hostname + "/node/api/flows"
7
8
body = {
9
"owner_id": "1",
10
"item_ids": [
11
"5e3c15338d44b91b57eec165",
12
"5e3c151e8d44b91b57eec0c1",
13
"5e466ebf8d44b91b57f174f4"
14
]
15
}
16
17
response = requests.request("POST", url, json=body, auth=(login, password))
18
print(response.text)
Copied!

Response example

1
{
2
"owner_id": 1,
3
"item_ids": [
4
"5e4e84fa39438824a1046829",
5
"5e552961d4511026d723154d",
6
"5e6f477fd462c02529b06eb7"
7
],
8
"id": "5e7b473e60250428b858f7c4"
9
}
Copied!
Last modified 1yr ago