Skip to content

Add Flow's Document

Adds a document for a flow with the specified ID.

Request

HTTP Request

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

Permissions

upload-documents | create-documents | manage-documents | manage-flows

Path parameters

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

Request body

The request body is empty.

Response

Work in Progress

This topic is a work in progress and may be incomplete.

Examples

Below is an example of a request body representing a link to a document:

{
    "name": "Dataflow",
    "type_id": 6,
    "value": "https://en.wikipedia.org/wiki/Dataflow"
}

Provided the content is saved in a file named body.json (required), a request can be done like this:

login=<your_login>
password=<your_password>
saymon_hostname=<your_saymon_hostname>
flow_id=<your_flow_id>
url=https://$saymon_hostname/node/api/flows/$flow_id/docs

curl -X POST $url -u $login:$password \
    -H "Content-Type: application/json" \
    --data @/path/to/body.json
const request = require("request");
const fs = require("fs");

let login = <your_login>
let password = <your_password>
let saymon_hostname = <your_saymon_hostname>
let flow_id = <your_flow_id>
let url = "https://" + saymon_hostname + "/node/api/flows/" +
    flow_id + "/docs";

let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
let body = JSON.parse(fs.readFileSync("/path/to/body.json"));

let options = {
    method: "POST",
    url: url,
    headers: {
        Authorization: auth
    },
    json : body
};

request(options, function (error, response, body) {
    if (error) throw new Error(error);
});
import requests
import json

login = <your_login>
password = <your_password>
saymon_hostname = <your_saymon_hostname>
flow_id = <your_flow_id>
url = "https://" + saymon_hostname + "/node/api/flows/" + \
    flow_id + "/docs"

with open("/path/to/body.json", "r") as f:
    body = json.load(f)

response = requests.request("POST", url, json=body, auth=(login, password))
print(response.text)

Uploading a document

login=<your_login>
password=<your_password>
saymon_hostname=<your_saymon_hostname>
flow_id=<your_flow_id>
url=https://$saymon_hostname/node/api/flows/$flow_id/docs

curl -u $login:$password \
    -F "file=@/path/to/Dataflow.pdf;type=application/pdf" $url
const request = require("request");
const fs = require("fs");

let login = <your_login>
let password = <your_password>
let saymon_hostname = <your_saymon_hostname>
let flow_id = <your_flow_id>
let url = "https://" + saymon_hostname + "/node/api/flows/" +
    flow_id + "/docs";

let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");

let options = {
    method: "POST",
    url: url,
    headers: {
        Authorization: auth
    },
    formData: {
        file: fs.createReadStream("/path/to/Dataflow.pdf"),
        filetype: "pdf",
        filename: "Dataflow.pdf"
    }
};

request(options, function (error, response, body) {
    if (error) throw new Error(error);
    console.log(body);
});
import requests
import json

login = <your_login>
password = <your_password>
saymon_hostname = <your_saymon_hostname>
flow_id = <your_flow_id>
url = "https://" + saymon_hostname + "/node/api/flows/" + \
    flow_id + "/docs";

files = {
    "file": (
        "Dataflow.pdf",
        open("/path/to/Dataflow.pdf", "rb"),
        "application/pdf"
    )
}

response = requests.request("POST", url, files=files, auth=(login, password))
print(response.text)