Add Flow's Document [*]

POST /node/api/flows/:id/docs

Adds a document for a flow with the specified ID.
Permissions: upload-documents | create-documents | manage-documents | manage-flows.

Request parameters

Path parameters

Parameter
Type
Description
id
string
required
The ID of a flow for which a document should be added.

Response description

...

Examples

Below is an example of a request body representing a link to a document:
body.json
1
{
2
"name": "Dataflow",
3
"type_id": 6,
4
"value": "https://en.wikipedia.org/wiki/Dataflow"
5
}
Copied!
Provided the content is saved in a file named body.jrequiredson, a request can be done like this:
Bash
NodeJS
Python
1
login=<your_login>
2
password=<your_password>
3
saymon_hostname=<your_saymon_hostname>
4
flow_id=<your_flow_id>
5
url=https://$saymon_hostname/node/api/flows/$flow_id/docs
6
7
curl -X POST $url -u $login:$password \
8
-H "Content-Type: application/json" \
9
--data @/path/to/body.json
Copied!
1
const request = require("request");
2
const fs = require("fs");
3
4
let login = <your_login>
5
let password = <your_password>
6
let saymon_hostname = <your_saymon_hostname>
7
let flow_id = <your_flow_id>
8
let url = "https://" + saymon_hostname + "/node/api/flows/" +
9
flow_id + "/docs";
10
11
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
12
let body = JSON.parse(fs.readFileSync("/path/to/body.json"));
13
14
let options = {
15
method: "POST",
16
url: url,
17
headers: {
18
Authorization: auth
19
},
20
json : body
21
};
22
23
request(options, function (error, response, body) {
24
if (error) throw new Error(error);
25
});
Copied!
1
import requests
2
import json
3
4
login = <your_login>
5
password = <your_password>
6
saymon_hostname = <your_saymon_hostname>
7
flow_id = <your_flow_id>
8
url = "https://" + saymon_hostname + "/node/api/flows/" + \
9
flow_id + "/docs"
10
11
with open("/path/to/body.json", "r") as f:
12
body = json.load(f)
13
14
response = requests.request("POST", url, json=body, auth=(login, password))
15
print(response.text)
Copied!

Uploading a document

Bash
NodeJS
Python
1
login=<your_login>
2
password=<your_password>
3
saymon_hostname=<your_saymon_hostname>
4
flow_id=<your_flow_id>
5
url=https://$saymon_hostname/node/api/flows/$flow_id/docs
6
7
curl -u $login:$password \
8
-F "[email protected]/path/to/Dataflow.pdf;type=application/pdf" $url
Copied!
1
const request = require("request");
2
const fs = require("fs");
3
4
let login = <your_login>
5
let password = <your_password>
6
let saymon_hostname = <your_saymon_hostname>
7
let flow_id = <your_flow_id>
8
let url = "https://" + saymon_hostname + "/node/api/flows/" +
9
flow_id + "/docs";
10
11
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
12
13
let options = {
14
method: "POST",
15
url: url,
16
headers: {
17
Authorization: auth
18
},
19
formData: {
20
file: fs.createReadStream("/path/to/Dataflow.pdf"),
21
filetype: "pdf",
22
filename: "Dataflow.pdf"
23
}
24
};
25
26
request(options, function (error, response, body) {
27
if (error) throw new Error(error);
28
console.log(body);
29
});
Copied!
1
import requests
2
import json
3
4
login = <your_login>
5
password = <your_password>
6
saymon_hostname = <your_saymon_hostname>
7
flow_id = <your_flow_id>
8
url = "https://" + saymon_hostname + "/node/api/flows/" + \
9
flow_id + "/docs";
10
11
files = {
12
"file": (
13
"Dataflow.pdf",
14
open("/path/to/Dataflow.pdf", "rb"),
15
"application/pdf"
16
)
17
}
18
19
response = requests.request("POST", url, files=files, auth=(login, password))
20
print(response.text)
Copied!
Last modified 1yr ago