Import a console flow as an app function (AS21)
curl --request POST \
--url https://api.eddy.engineer/v1/flows.import \
--header 'Content-Type: application/json' \
--data '
{
"flow": {
"edges": [
{
"from": "n1",
"to": "n2"
}
],
"nodes": [
{
"config": {
"constraints": [
{
"fixed": "all",
"region": "x_min"
}
],
"geometry": {
"primitive": {
"box": {
"lx": 1,
"ly": 0.2,
"lz": 0.2
}
}
},
"loads": [
{
"force": [
0,
0,
-1000
],
"region": "x_max"
}
],
"material": {
"e": 210000000000,
"id": "steel",
"nu": 0.3,
"rho": 7850,
"yield": 250000000
},
"mesh_opts": {
"element_size": 0.1
}
},
"id": "n1",
"type": "structural"
},
{
"config": {},
"id": "n2",
"type": "verify"
}
]
},
"name": "Bar check"
}
'import requests
url = "https://api.eddy.engineer/v1/flows.import"
payload = {
"flow": {
"edges": [
{
"from": "n1",
"to": "n2"
}
],
"nodes": [
{
"config": {
"constraints": [
{
"fixed": "all",
"region": "x_min"
}
],
"geometry": { "primitive": { "box": {
"lx": 1,
"ly": 0.2,
"lz": 0.2
} } },
"loads": [
{
"force": [0, 0, -1000],
"region": "x_max"
}
],
"material": {
"e": 210000000000,
"id": "steel",
"nu": 0.3,
"rho": 7850,
"yield": 250000000
},
"mesh_opts": { "element_size": 0.1 }
},
"id": "n1",
"type": "structural"
},
{
"config": {},
"id": "n2",
"type": "verify"
}
]
},
"name": "Bar check"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
flow: {
edges: [{from: 'n1', to: 'n2'}],
nodes: [
{
config: {
constraints: [{fixed: 'all', region: 'x_min'}],
geometry: {primitive: {box: {lx: 1, ly: 0.2, lz: 0.2}}},
loads: [{force: [0, 0, -1000], region: 'x_max'}],
material: {e: 210000000000, id: 'steel', nu: 0.3, rho: 7850, yield: 250000000},
mesh_opts: {element_size: 0.1}
},
id: 'n1',
type: 'structural'
},
{config: {}, id: 'n2', type: 'verify'}
]
},
name: 'Bar check'
})
};
fetch('https://api.eddy.engineer/v1/flows.import', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.eddy.engineer/v1/flows.import",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'flow' => [
'edges' => [
[
'from' => 'n1',
'to' => 'n2'
]
],
'nodes' => [
[
'config' => [
'constraints' => [
[
'fixed' => 'all',
'region' => 'x_min'
]
],
'geometry' => [
'primitive' => [
'box' => [
'lx' => 1,
'ly' => 0.2,
'lz' => 0.2
]
]
],
'loads' => [
[
'force' => [
0,
0,
-1000
],
'region' => 'x_max'
]
],
'material' => [
'e' => 210000000000,
'id' => 'steel',
'nu' => 0.3,
'rho' => 7850,
'yield' => 250000000
],
'mesh_opts' => [
'element_size' => 0.1
]
],
'id' => 'n1',
'type' => 'structural'
],
[
'config' => [
],
'id' => 'n2',
'type' => 'verify'
]
]
],
'name' => 'Bar check'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.eddy.engineer/v1/flows.import"
payload := strings.NewReader("{\n \"flow\": {\n \"edges\": [\n {\n \"from\": \"n1\",\n \"to\": \"n2\"\n }\n ],\n \"nodes\": [\n {\n \"config\": {\n \"constraints\": [\n {\n \"fixed\": \"all\",\n \"region\": \"x_min\"\n }\n ],\n \"geometry\": {\n \"primitive\": {\n \"box\": {\n \"lx\": 1,\n \"ly\": 0.2,\n \"lz\": 0.2\n }\n }\n },\n \"loads\": [\n {\n \"force\": [\n 0,\n 0,\n -1000\n ],\n \"region\": \"x_max\"\n }\n ],\n \"material\": {\n \"e\": 210000000000,\n \"id\": \"steel\",\n \"nu\": 0.3,\n \"rho\": 7850,\n \"yield\": 250000000\n },\n \"mesh_opts\": {\n \"element_size\": 0.1\n }\n },\n \"id\": \"n1\",\n \"type\": \"structural\"\n },\n {\n \"config\": {},\n \"id\": \"n2\",\n \"type\": \"verify\"\n }\n ]\n },\n \"name\": \"Bar check\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.eddy.engineer/v1/flows.import")
.header("Content-Type", "application/json")
.body("{\n \"flow\": {\n \"edges\": [\n {\n \"from\": \"n1\",\n \"to\": \"n2\"\n }\n ],\n \"nodes\": [\n {\n \"config\": {\n \"constraints\": [\n {\n \"fixed\": \"all\",\n \"region\": \"x_min\"\n }\n ],\n \"geometry\": {\n \"primitive\": {\n \"box\": {\n \"lx\": 1,\n \"ly\": 0.2,\n \"lz\": 0.2\n }\n }\n },\n \"loads\": [\n {\n \"force\": [\n 0,\n 0,\n -1000\n ],\n \"region\": \"x_max\"\n }\n ],\n \"material\": {\n \"e\": 210000000000,\n \"id\": \"steel\",\n \"nu\": 0.3,\n \"rho\": 7850,\n \"yield\": 250000000\n },\n \"mesh_opts\": {\n \"element_size\": 0.1\n }\n },\n \"id\": \"n1\",\n \"type\": \"structural\"\n },\n {\n \"config\": {},\n \"id\": \"n2\",\n \"type\": \"verify\"\n }\n ]\n },\n \"name\": \"Bar check\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eddy.engineer/v1/flows.import")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"flow\": {\n \"edges\": [\n {\n \"from\": \"n1\",\n \"to\": \"n2\"\n }\n ],\n \"nodes\": [\n {\n \"config\": {\n \"constraints\": [\n {\n \"fixed\": \"all\",\n \"region\": \"x_min\"\n }\n ],\n \"geometry\": {\n \"primitive\": {\n \"box\": {\n \"lx\": 1,\n \"ly\": 0.2,\n \"lz\": 0.2\n }\n }\n },\n \"loads\": [\n {\n \"force\": [\n 0,\n 0,\n -1000\n ],\n \"region\": \"x_max\"\n }\n ],\n \"material\": {\n \"e\": 210000000000,\n \"id\": \"steel\",\n \"nu\": 0.3,\n \"rho\": 7850,\n \"yield\": 250000000\n },\n \"mesh_opts\": {\n \"element_size\": 0.1\n }\n },\n \"id\": \"n1\",\n \"type\": \"structural\"\n },\n {\n \"config\": {},\n \"id\": \"n2\",\n \"type\": \"verify\"\n }\n ]\n },\n \"name\": \"Bar check\"\n}"
response = http.request(request)
puts response.read_body{}Meta
Import a console flow as an app function (AS21)
Turns one of the console’s agent flows (a DAG of structural and thermal solves, verifications and reports) into the caller’s own studio app: its Lab function run is the flow as a short script, the nodes in topological order, each the engine call the browser made, each node’s result key (and a solve’s headline number) an output. Saved through POST /v1/apps’ own save (answers as it does, plus function and open). A cycle, an unknown node type, or a verification with no upstream solve is 400 INVALID_FLOW.
POST
/
v1
/
flows.import
Import a console flow as an app function (AS21)
curl --request POST \
--url https://api.eddy.engineer/v1/flows.import \
--header 'Content-Type: application/json' \
--data '
{
"flow": {
"edges": [
{
"from": "n1",
"to": "n2"
}
],
"nodes": [
{
"config": {
"constraints": [
{
"fixed": "all",
"region": "x_min"
}
],
"geometry": {
"primitive": {
"box": {
"lx": 1,
"ly": 0.2,
"lz": 0.2
}
}
},
"loads": [
{
"force": [
0,
0,
-1000
],
"region": "x_max"
}
],
"material": {
"e": 210000000000,
"id": "steel",
"nu": 0.3,
"rho": 7850,
"yield": 250000000
},
"mesh_opts": {
"element_size": 0.1
}
},
"id": "n1",
"type": "structural"
},
{
"config": {},
"id": "n2",
"type": "verify"
}
]
},
"name": "Bar check"
}
'import requests
url = "https://api.eddy.engineer/v1/flows.import"
payload = {
"flow": {
"edges": [
{
"from": "n1",
"to": "n2"
}
],
"nodes": [
{
"config": {
"constraints": [
{
"fixed": "all",
"region": "x_min"
}
],
"geometry": { "primitive": { "box": {
"lx": 1,
"ly": 0.2,
"lz": 0.2
} } },
"loads": [
{
"force": [0, 0, -1000],
"region": "x_max"
}
],
"material": {
"e": 210000000000,
"id": "steel",
"nu": 0.3,
"rho": 7850,
"yield": 250000000
},
"mesh_opts": { "element_size": 0.1 }
},
"id": "n1",
"type": "structural"
},
{
"config": {},
"id": "n2",
"type": "verify"
}
]
},
"name": "Bar check"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
flow: {
edges: [{from: 'n1', to: 'n2'}],
nodes: [
{
config: {
constraints: [{fixed: 'all', region: 'x_min'}],
geometry: {primitive: {box: {lx: 1, ly: 0.2, lz: 0.2}}},
loads: [{force: [0, 0, -1000], region: 'x_max'}],
material: {e: 210000000000, id: 'steel', nu: 0.3, rho: 7850, yield: 250000000},
mesh_opts: {element_size: 0.1}
},
id: 'n1',
type: 'structural'
},
{config: {}, id: 'n2', type: 'verify'}
]
},
name: 'Bar check'
})
};
fetch('https://api.eddy.engineer/v1/flows.import', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.eddy.engineer/v1/flows.import",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'flow' => [
'edges' => [
[
'from' => 'n1',
'to' => 'n2'
]
],
'nodes' => [
[
'config' => [
'constraints' => [
[
'fixed' => 'all',
'region' => 'x_min'
]
],
'geometry' => [
'primitive' => [
'box' => [
'lx' => 1,
'ly' => 0.2,
'lz' => 0.2
]
]
],
'loads' => [
[
'force' => [
0,
0,
-1000
],
'region' => 'x_max'
]
],
'material' => [
'e' => 210000000000,
'id' => 'steel',
'nu' => 0.3,
'rho' => 7850,
'yield' => 250000000
],
'mesh_opts' => [
'element_size' => 0.1
]
],
'id' => 'n1',
'type' => 'structural'
],
[
'config' => [
],
'id' => 'n2',
'type' => 'verify'
]
]
],
'name' => 'Bar check'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.eddy.engineer/v1/flows.import"
payload := strings.NewReader("{\n \"flow\": {\n \"edges\": [\n {\n \"from\": \"n1\",\n \"to\": \"n2\"\n }\n ],\n \"nodes\": [\n {\n \"config\": {\n \"constraints\": [\n {\n \"fixed\": \"all\",\n \"region\": \"x_min\"\n }\n ],\n \"geometry\": {\n \"primitive\": {\n \"box\": {\n \"lx\": 1,\n \"ly\": 0.2,\n \"lz\": 0.2\n }\n }\n },\n \"loads\": [\n {\n \"force\": [\n 0,\n 0,\n -1000\n ],\n \"region\": \"x_max\"\n }\n ],\n \"material\": {\n \"e\": 210000000000,\n \"id\": \"steel\",\n \"nu\": 0.3,\n \"rho\": 7850,\n \"yield\": 250000000\n },\n \"mesh_opts\": {\n \"element_size\": 0.1\n }\n },\n \"id\": \"n1\",\n \"type\": \"structural\"\n },\n {\n \"config\": {},\n \"id\": \"n2\",\n \"type\": \"verify\"\n }\n ]\n },\n \"name\": \"Bar check\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.eddy.engineer/v1/flows.import")
.header("Content-Type", "application/json")
.body("{\n \"flow\": {\n \"edges\": [\n {\n \"from\": \"n1\",\n \"to\": \"n2\"\n }\n ],\n \"nodes\": [\n {\n \"config\": {\n \"constraints\": [\n {\n \"fixed\": \"all\",\n \"region\": \"x_min\"\n }\n ],\n \"geometry\": {\n \"primitive\": {\n \"box\": {\n \"lx\": 1,\n \"ly\": 0.2,\n \"lz\": 0.2\n }\n }\n },\n \"loads\": [\n {\n \"force\": [\n 0,\n 0,\n -1000\n ],\n \"region\": \"x_max\"\n }\n ],\n \"material\": {\n \"e\": 210000000000,\n \"id\": \"steel\",\n \"nu\": 0.3,\n \"rho\": 7850,\n \"yield\": 250000000\n },\n \"mesh_opts\": {\n \"element_size\": 0.1\n }\n },\n \"id\": \"n1\",\n \"type\": \"structural\"\n },\n {\n \"config\": {},\n \"id\": \"n2\",\n \"type\": \"verify\"\n }\n ]\n },\n \"name\": \"Bar check\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eddy.engineer/v1/flows.import")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"flow\": {\n \"edges\": [\n {\n \"from\": \"n1\",\n \"to\": \"n2\"\n }\n ],\n \"nodes\": [\n {\n \"config\": {\n \"constraints\": [\n {\n \"fixed\": \"all\",\n \"region\": \"x_min\"\n }\n ],\n \"geometry\": {\n \"primitive\": {\n \"box\": {\n \"lx\": 1,\n \"ly\": 0.2,\n \"lz\": 0.2\n }\n }\n },\n \"loads\": [\n {\n \"force\": [\n 0,\n 0,\n -1000\n ],\n \"region\": \"x_max\"\n }\n ],\n \"material\": {\n \"e\": 210000000000,\n \"id\": \"steel\",\n \"nu\": 0.3,\n \"rho\": 7850,\n \"yield\": 250000000\n },\n \"mesh_opts\": {\n \"element_size\": 0.1\n }\n },\n \"id\": \"n1\",\n \"type\": \"structural\"\n },\n {\n \"config\": {},\n \"id\": \"n2\",\n \"type\": \"verify\"\n }\n ]\n },\n \"name\": \"Bar check\"\n}"
response = http.request(request)
puts response.read_body{}