Crea un flux
Crea un nou flux d’automatització per a l’organització especificada. El flux defineix la lògica d’execució, les condicions i els workspaces objectius. Retorna les dades del flux creat després d’una creació exitosa.
curl --request POST \
--url https://api.flexxible.net/v2/organizations/{organization_id}/flows \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": {
"en-EN": "Daily Backup Flow",
"es-ES": "Proceso de copia diaria"
},
"description": {
"en-EN": "Automated daily backup process",
"es-ES": "Proceso automatizado de copia de seguridad diaria"
},
"type": "workspace",
"detection_only": false,
"cooldown_minutes": 60,
"enabled": false,
"init_text": {
"en-EN": "Starting backup process...",
"es-ES": "Iniciando proceso de copia..."
},
"ok_text": {
"en-EN": "Backup completed successfully",
"es-ES": "Copia completada correctamente"
},
"ko_text": {
"en-EN": "Backup failed. Please check logs.",
"es-ES": "Copia fallida. Revise los registros."
},
"target": {
"type": "workspaces",
"ids": [
"507f1f77bcf86cd799439012",
"507f1f77bcf86cd799439013"
]
},
"microservice_id": "507f1f77bcf86cd799439014",
"conditions": [
{
"condition_type_id": "507f1f77bcf86cd799439015",
"operator": "gt",
"compare_to": "80",
"check_every": 300
}
]
}
'import requests
url = "https://api.flexxible.net/v2/organizations/{organization_id}/flows"
payload = {
"name": {
"en-EN": "Daily Backup Flow",
"es-ES": "Proceso de copia diaria"
},
"description": {
"en-EN": "Automated daily backup process",
"es-ES": "Proceso automatizado de copia de seguridad diaria"
},
"type": "workspace",
"detection_only": False,
"cooldown_minutes": 60,
"enabled": False,
"init_text": {
"en-EN": "Starting backup process...",
"es-ES": "Iniciando proceso de copia..."
},
"ok_text": {
"en-EN": "Backup completed successfully",
"es-ES": "Copia completada correctamente"
},
"ko_text": {
"en-EN": "Backup failed. Please check logs.",
"es-ES": "Copia fallida. Revise los registros."
},
"target": {
"type": "workspaces",
"ids": ["507f1f77bcf86cd799439012", "507f1f77bcf86cd799439013"]
},
"microservice_id": "507f1f77bcf86cd799439014",
"conditions": [
{
"condition_type_id": "507f1f77bcf86cd799439015",
"operator": "gt",
"compare_to": "80",
"check_every": 300
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: {'en-EN': 'Daily Backup Flow', 'es-ES': 'Proceso de copia diaria'},
description: {
'en-EN': 'Automated daily backup process',
'es-ES': 'Proceso automatizado de copia de seguridad diaria'
},
type: 'workspace',
detection_only: false,
cooldown_minutes: 60,
enabled: false,
init_text: {
'en-EN': 'Starting backup process...',
'es-ES': 'Iniciando proceso de copia...'
},
ok_text: {
'en-EN': 'Backup completed successfully',
'es-ES': 'Copia completada correctamente'
},
ko_text: {
'en-EN': 'Backup failed. Please check logs.',
'es-ES': 'Copia fallida. Revise los registros.'
},
target: {
type: 'workspaces',
ids: ['507f1f77bcf86cd799439012', '507f1f77bcf86cd799439013']
},
microservice_id: '507f1f77bcf86cd799439014',
conditions: [
{
condition_type_id: '507f1f77bcf86cd799439015',
operator: 'gt',
compare_to: '80',
check_every: 300
}
]
})
};
fetch('https://api.flexxible.net/v2/organizations/{organization_id}/flows', 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.flexxible.net/v2/organizations/{organization_id}/flows",
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([
'name' => [
'en-EN' => 'Daily Backup Flow',
'es-ES' => 'Proceso de copia diaria'
],
'description' => [
'en-EN' => 'Automated daily backup process',
'es-ES' => 'Proceso automatizado de copia de seguridad diaria'
],
'type' => 'workspace',
'detection_only' => false,
'cooldown_minutes' => 60,
'enabled' => false,
'init_text' => [
'en-EN' => 'Starting backup process...',
'es-ES' => 'Iniciando proceso de copia...'
],
'ok_text' => [
'en-EN' => 'Backup completed successfully',
'es-ES' => 'Copia completada correctamente'
],
'ko_text' => [
'en-EN' => 'Backup failed. Please check logs.',
'es-ES' => 'Copia fallida. Revise los registros.'
],
'target' => [
'type' => 'workspaces',
'ids' => [
'507f1f77bcf86cd799439012',
'507f1f77bcf86cd799439013'
]
],
'microservice_id' => '507f1f77bcf86cd799439014',
'conditions' => [
[
'condition_type_id' => '507f1f77bcf86cd799439015',
'operator' => 'gt',
'compare_to' => '80',
'check_every' => 300
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.flexxible.net/v2/organizations/{organization_id}/flows"
payload := strings.NewReader("{\n \"name\": {\n \"en-EN\": \"Daily Backup Flow\",\n \"es-ES\": \"Proceso de copia diaria\"\n },\n \"description\": {\n \"en-EN\": \"Automated daily backup process\",\n \"es-ES\": \"Proceso automatizado de copia de seguridad diaria\"\n },\n \"type\": \"workspace\",\n \"detection_only\": false,\n \"cooldown_minutes\": 60,\n \"enabled\": false,\n \"init_text\": {\n \"en-EN\": \"Starting backup process...\",\n \"es-ES\": \"Iniciando proceso de copia...\"\n },\n \"ok_text\": {\n \"en-EN\": \"Backup completed successfully\",\n \"es-ES\": \"Copia completada correctamente\"\n },\n \"ko_text\": {\n \"en-EN\": \"Backup failed. Please check logs.\",\n \"es-ES\": \"Copia fallida. Revise los registros.\"\n },\n \"target\": {\n \"type\": \"workspaces\",\n \"ids\": [\n \"507f1f77bcf86cd799439012\",\n \"507f1f77bcf86cd799439013\"\n ]\n },\n \"microservice_id\": \"507f1f77bcf86cd799439014\",\n \"conditions\": [\n {\n \"condition_type_id\": \"507f1f77bcf86cd799439015\",\n \"operator\": \"gt\",\n \"compare_to\": \"80\",\n \"check_every\": 300\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.flexxible.net/v2/organizations/{organization_id}/flows")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": {\n \"en-EN\": \"Daily Backup Flow\",\n \"es-ES\": \"Proceso de copia diaria\"\n },\n \"description\": {\n \"en-EN\": \"Automated daily backup process\",\n \"es-ES\": \"Proceso automatizado de copia de seguridad diaria\"\n },\n \"type\": \"workspace\",\n \"detection_only\": false,\n \"cooldown_minutes\": 60,\n \"enabled\": false,\n \"init_text\": {\n \"en-EN\": \"Starting backup process...\",\n \"es-ES\": \"Iniciando proceso de copia...\"\n },\n \"ok_text\": {\n \"en-EN\": \"Backup completed successfully\",\n \"es-ES\": \"Copia completada correctamente\"\n },\n \"ko_text\": {\n \"en-EN\": \"Backup failed. Please check logs.\",\n \"es-ES\": \"Copia fallida. Revise los registros.\"\n },\n \"target\": {\n \"type\": \"workspaces\",\n \"ids\": [\n \"507f1f77bcf86cd799439012\",\n \"507f1f77bcf86cd799439013\"\n ]\n },\n \"microservice_id\": \"507f1f77bcf86cd799439014\",\n \"conditions\": [\n {\n \"condition_type_id\": \"507f1f77bcf86cd799439015\",\n \"operator\": \"gt\",\n \"compare_to\": \"80\",\n \"check_every\": 300\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flexxible.net/v2/organizations/{organization_id}/flows")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": {\n \"en-EN\": \"Daily Backup Flow\",\n \"es-ES\": \"Proceso de copia diaria\"\n },\n \"description\": {\n \"en-EN\": \"Automated daily backup process\",\n \"es-ES\": \"Proceso automatizado de copia de seguridad diaria\"\n },\n \"type\": \"workspace\",\n \"detection_only\": false,\n \"cooldown_minutes\": 60,\n \"enabled\": false,\n \"init_text\": {\n \"en-EN\": \"Starting backup process...\",\n \"es-ES\": \"Iniciando proceso de copia...\"\n },\n \"ok_text\": {\n \"en-EN\": \"Backup completed successfully\",\n \"es-ES\": \"Copia completada correctamente\"\n },\n \"ko_text\": {\n \"en-EN\": \"Backup failed. Please check logs.\",\n \"es-ES\": \"Copia fallida. Revise los registros.\"\n },\n \"target\": {\n \"type\": \"workspaces\",\n \"ids\": [\n \"507f1f77bcf86cd799439012\",\n \"507f1f77bcf86cd799439013\"\n ]\n },\n \"microservice_id\": \"507f1f77bcf86cd799439014\",\n \"conditions\": [\n {\n \"condition_type_id\": \"507f1f77bcf86cd799439015\",\n \"operator\": \"gt\",\n \"compare_to\": \"80\",\n \"check_every\": 300\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "507f1f77bcf86cd799439011"
}{
"error": {
"message": "<string>",
"code": "<string>",
"details": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"details": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"details": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"details": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"details": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"details": "<string>"
}
}Autoritzacions
Capçaleres
Código de idioma para campos de texto que admiten varios idiomas. Al crear o actualizar recursos, esto especifica el idioma de los valores de texto proporcionados. Al recuperar recursos, esto determina qué variante de idioma de los campos de texto multilingües se devuelve. Valores aceptados: 'en-EN' (inglés), 'es-ES' (español), 'pt-BR' (portugués), 'ca-ES' (catalán), 'eu-ES' (euskera), 'fr-CA' (francés canadiense). El valor predeterminado es 'es-ES' si no se proporciona.
en-EN, es-ES, pt-BR, ca-ES, eu-ES, fr-CA Paràmetres de ruta
Cos
Resposta
Flux creat correctament. La resposta conté el recurs creat.
Detall del flux tal com el retorna GET flow by id. L'organització és implícita per la ruta /v2/organizations/{organization_id}/flows/{flow_id}. Els espais de treball/grups de destinació es normalitzen en target.ids (cadenes hexadecimals de ObjectId de MongoDB).
curl --request POST \
--url https://api.flexxible.net/v2/organizations/{organization_id}/flows \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": {
"en-EN": "Daily Backup Flow",
"es-ES": "Proceso de copia diaria"
},
"description": {
"en-EN": "Automated daily backup process",
"es-ES": "Proceso automatizado de copia de seguridad diaria"
},
"type": "workspace",
"detection_only": false,
"cooldown_minutes": 60,
"enabled": false,
"init_text": {
"en-EN": "Starting backup process...",
"es-ES": "Iniciando proceso de copia..."
},
"ok_text": {
"en-EN": "Backup completed successfully",
"es-ES": "Copia completada correctamente"
},
"ko_text": {
"en-EN": "Backup failed. Please check logs.",
"es-ES": "Copia fallida. Revise los registros."
},
"target": {
"type": "workspaces",
"ids": [
"507f1f77bcf86cd799439012",
"507f1f77bcf86cd799439013"
]
},
"microservice_id": "507f1f77bcf86cd799439014",
"conditions": [
{
"condition_type_id": "507f1f77bcf86cd799439015",
"operator": "gt",
"compare_to": "80",
"check_every": 300
}
]
}
'import requests
url = "https://api.flexxible.net/v2/organizations/{organization_id}/flows"
payload = {
"name": {
"en-EN": "Daily Backup Flow",
"es-ES": "Proceso de copia diaria"
},
"description": {
"en-EN": "Automated daily backup process",
"es-ES": "Proceso automatizado de copia de seguridad diaria"
},
"type": "workspace",
"detection_only": False,
"cooldown_minutes": 60,
"enabled": False,
"init_text": {
"en-EN": "Starting backup process...",
"es-ES": "Iniciando proceso de copia..."
},
"ok_text": {
"en-EN": "Backup completed successfully",
"es-ES": "Copia completada correctamente"
},
"ko_text": {
"en-EN": "Backup failed. Please check logs.",
"es-ES": "Copia fallida. Revise los registros."
},
"target": {
"type": "workspaces",
"ids": ["507f1f77bcf86cd799439012", "507f1f77bcf86cd799439013"]
},
"microservice_id": "507f1f77bcf86cd799439014",
"conditions": [
{
"condition_type_id": "507f1f77bcf86cd799439015",
"operator": "gt",
"compare_to": "80",
"check_every": 300
}
]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: {'en-EN': 'Daily Backup Flow', 'es-ES': 'Proceso de copia diaria'},
description: {
'en-EN': 'Automated daily backup process',
'es-ES': 'Proceso automatizado de copia de seguridad diaria'
},
type: 'workspace',
detection_only: false,
cooldown_minutes: 60,
enabled: false,
init_text: {
'en-EN': 'Starting backup process...',
'es-ES': 'Iniciando proceso de copia...'
},
ok_text: {
'en-EN': 'Backup completed successfully',
'es-ES': 'Copia completada correctamente'
},
ko_text: {
'en-EN': 'Backup failed. Please check logs.',
'es-ES': 'Copia fallida. Revise los registros.'
},
target: {
type: 'workspaces',
ids: ['507f1f77bcf86cd799439012', '507f1f77bcf86cd799439013']
},
microservice_id: '507f1f77bcf86cd799439014',
conditions: [
{
condition_type_id: '507f1f77bcf86cd799439015',
operator: 'gt',
compare_to: '80',
check_every: 300
}
]
})
};
fetch('https://api.flexxible.net/v2/organizations/{organization_id}/flows', 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.flexxible.net/v2/organizations/{organization_id}/flows",
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([
'name' => [
'en-EN' => 'Daily Backup Flow',
'es-ES' => 'Proceso de copia diaria'
],
'description' => [
'en-EN' => 'Automated daily backup process',
'es-ES' => 'Proceso automatizado de copia de seguridad diaria'
],
'type' => 'workspace',
'detection_only' => false,
'cooldown_minutes' => 60,
'enabled' => false,
'init_text' => [
'en-EN' => 'Starting backup process...',
'es-ES' => 'Iniciando proceso de copia...'
],
'ok_text' => [
'en-EN' => 'Backup completed successfully',
'es-ES' => 'Copia completada correctamente'
],
'ko_text' => [
'en-EN' => 'Backup failed. Please check logs.',
'es-ES' => 'Copia fallida. Revise los registros.'
],
'target' => [
'type' => 'workspaces',
'ids' => [
'507f1f77bcf86cd799439012',
'507f1f77bcf86cd799439013'
]
],
'microservice_id' => '507f1f77bcf86cd799439014',
'conditions' => [
[
'condition_type_id' => '507f1f77bcf86cd799439015',
'operator' => 'gt',
'compare_to' => '80',
'check_every' => 300
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.flexxible.net/v2/organizations/{organization_id}/flows"
payload := strings.NewReader("{\n \"name\": {\n \"en-EN\": \"Daily Backup Flow\",\n \"es-ES\": \"Proceso de copia diaria\"\n },\n \"description\": {\n \"en-EN\": \"Automated daily backup process\",\n \"es-ES\": \"Proceso automatizado de copia de seguridad diaria\"\n },\n \"type\": \"workspace\",\n \"detection_only\": false,\n \"cooldown_minutes\": 60,\n \"enabled\": false,\n \"init_text\": {\n \"en-EN\": \"Starting backup process...\",\n \"es-ES\": \"Iniciando proceso de copia...\"\n },\n \"ok_text\": {\n \"en-EN\": \"Backup completed successfully\",\n \"es-ES\": \"Copia completada correctamente\"\n },\n \"ko_text\": {\n \"en-EN\": \"Backup failed. Please check logs.\",\n \"es-ES\": \"Copia fallida. Revise los registros.\"\n },\n \"target\": {\n \"type\": \"workspaces\",\n \"ids\": [\n \"507f1f77bcf86cd799439012\",\n \"507f1f77bcf86cd799439013\"\n ]\n },\n \"microservice_id\": \"507f1f77bcf86cd799439014\",\n \"conditions\": [\n {\n \"condition_type_id\": \"507f1f77bcf86cd799439015\",\n \"operator\": \"gt\",\n \"compare_to\": \"80\",\n \"check_every\": 300\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.flexxible.net/v2/organizations/{organization_id}/flows")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": {\n \"en-EN\": \"Daily Backup Flow\",\n \"es-ES\": \"Proceso de copia diaria\"\n },\n \"description\": {\n \"en-EN\": \"Automated daily backup process\",\n \"es-ES\": \"Proceso automatizado de copia de seguridad diaria\"\n },\n \"type\": \"workspace\",\n \"detection_only\": false,\n \"cooldown_minutes\": 60,\n \"enabled\": false,\n \"init_text\": {\n \"en-EN\": \"Starting backup process...\",\n \"es-ES\": \"Iniciando proceso de copia...\"\n },\n \"ok_text\": {\n \"en-EN\": \"Backup completed successfully\",\n \"es-ES\": \"Copia completada correctamente\"\n },\n \"ko_text\": {\n \"en-EN\": \"Backup failed. Please check logs.\",\n \"es-ES\": \"Copia fallida. Revise los registros.\"\n },\n \"target\": {\n \"type\": \"workspaces\",\n \"ids\": [\n \"507f1f77bcf86cd799439012\",\n \"507f1f77bcf86cd799439013\"\n ]\n },\n \"microservice_id\": \"507f1f77bcf86cd799439014\",\n \"conditions\": [\n {\n \"condition_type_id\": \"507f1f77bcf86cd799439015\",\n \"operator\": \"gt\",\n \"compare_to\": \"80\",\n \"check_every\": 300\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flexxible.net/v2/organizations/{organization_id}/flows")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": {\n \"en-EN\": \"Daily Backup Flow\",\n \"es-ES\": \"Proceso de copia diaria\"\n },\n \"description\": {\n \"en-EN\": \"Automated daily backup process\",\n \"es-ES\": \"Proceso automatizado de copia de seguridad diaria\"\n },\n \"type\": \"workspace\",\n \"detection_only\": false,\n \"cooldown_minutes\": 60,\n \"enabled\": false,\n \"init_text\": {\n \"en-EN\": \"Starting backup process...\",\n \"es-ES\": \"Iniciando proceso de copia...\"\n },\n \"ok_text\": {\n \"en-EN\": \"Backup completed successfully\",\n \"es-ES\": \"Copia completada correctamente\"\n },\n \"ko_text\": {\n \"en-EN\": \"Backup failed. Please check logs.\",\n \"es-ES\": \"Copia fallida. Revise los registros.\"\n },\n \"target\": {\n \"type\": \"workspaces\",\n \"ids\": [\n \"507f1f77bcf86cd799439012\",\n \"507f1f77bcf86cd799439013\"\n ]\n },\n \"microservice_id\": \"507f1f77bcf86cd799439014\",\n \"conditions\": [\n {\n \"condition_type_id\": \"507f1f77bcf86cd799439015\",\n \"operator\": \"gt\",\n \"compare_to\": \"80\",\n \"check_every\": 300\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "507f1f77bcf86cd799439011"
}{
"error": {
"message": "<string>",
"code": "<string>",
"details": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"details": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"details": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"details": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"details": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"details": "<string>"
}
}