Flow
A Flow is used to store a list of steps, called nodes which are utilized by the FlowRun object during a run. There are two primary components for a flow: Each node contains data specific to the job for that step (i.e. Scan, Case, Slack Alert, etc)
| Component | Description |
|---|---|
nodes | a list of objects with instructions specific to that step (i.e. Scan, Slack Alert, etc) |
edges | a list of objects describing the flow's direction of operation and relationship between nodes |
Flow object
{
"id": "cc5a0ede-1aff-4eff-8040-9f4c0783f043",
"user": "dev@example.com",
"account": "8d4075a8-5ba0-48c9-9735-b989595edad5",
"time_created": "2024-11-15T17:41:21.464269Z",
"title": "Dual Step Flow",
"nodes": [
{
"id": "1",
"data": {
"id": "1",
"uri": "",
"type": [
"html",
"logs",
"lighthouse",
"yellowlab",
"vrt"
],
"email": "",
"case_id": null,
"configs": {
"device": "Windows 10 PC",
"browser": "chrome",
"timeout": 300,
"interval": 1,
"location": "us",
"mask_ids": "",
"auto_height": true,
"end_on_fail": true,
"window_size": "1920,1080",
"create_issue": true,
"max_wait_time": 30,
"min_wait_time": 3,
"disable_animations": false
},
"headers": "{}",
"message": "",
"payload": "{}",
"subject": "",
"updates": null,
"maxConds": 4,
"maxNodes": 12,
"parentId": null,
"position": {
"x": 0,
"y": 0
},
"start_if": null,
"task_type": "scan",
"threshold": 95,
"conditions": null,
"phone_number": "",
"request_type": "GET"
},
"type": "basic",
"measured": {
"width": 272,
"height": 48
},
"parentId": null,
"position": {
"x": 0,
"y": 0
}
},
{
"id": "2",
"position": {
"x": 0,
"y": 150
},
"type": "basic",
"parentId": "1",
"data": {
"id": "2",
"position": {
"x": 0,
"y": 150
},
"parentId": "1",
"task_type": "slack",
"configs": {
"device": "Windows 10 PC",
"browser": "chrome",
"timeout": 300,
"interval": 1,
"location": "us",
"mask_ids": null,
"auto_height": true,
"end_on_fail": true,
"window_size": "1920,1080",
"create_issue": true,
"max_wait_time": 30,
"min_wait_time": 3,
"disable_animations": false
},
"conditions": null,
"start_if": null,
"maxNodes": 12,
"maxConds": 4,
"type": [
"html",
"logs",
"lighthouse",
"yellowlab",
"vrt"
],
"case_id": null,
"updates": null,
"threshold": 95,
"phone_number": "",
"email": "",
"uri": "",
"request_type": "GET",
"subject": "",
"message": "This is a test message",
"payload": "{}",
"headers": "{}"
},
"measured": {
"width": 272,
"height": 48
}
}
],
"edges": [
{
"id": "1",
"target": "2",
"source": "1",
"type": "smoothstep"
}
],
"time_last_run": null
}
Retrieve a Flow
This endpoint returns a single Flow object and is useful as a simple "detailed view" of the flow.
GET - /flow/<flow:id>
import requests, os
# import env vars
CURSION_API_BASE_URL = os.environ.get('CURSION_API_BASE_URL')
CURSION_API_TOKEN = os.environ.get('CURSION_API_TOKEN')
# setup configs
url = f'{BASE_URL}/flow/<flow:id>'
headers = {
"content-type": "application/json",
"Authorization" : CURSION_API_TOKEN
}
# send the request
res = requests.get(
url=url,
headers=headers,
)
# retrieve response data
json_response = res.json()
print(json_response)
View Full Output
{
"id": "cc5a0ede-1aff-4eff-8040-9f4c0783f043",
"user": "dev@example.com",
"account": "8d4075a8-5ba0-48c9-9735-b989595edad5",
"time_created": "2024-11-15T17:41:21.464269Z",
"title": "Dual Step Flow",
"nodes": [
{
"id": "1",
"data": {
"id": "1",
"uri": "",
"type": [
"html",
"logs",
"lighthouse",
"yellowlab",
"vrt"
],
"email": "",
"case_id": null,
"configs": {
"device": "Windows 10 PC",
"browser": "chrome",
"timeout": 300,
"interval": 1,
"location": "us",
"mask_ids": "",
"auto_height": true,
"end_on_fail": true,
"window_size": "1920,1080",
"create_issue": true,
"max_wait_time": 30,
"min_wait_time": 3,
"disable_animations": false
},
"headers": "{}",
"message": "",
"payload": "{}",
"subject": "",
"updates": null,
"maxConds": 4,
"maxNodes": 12,
"parentId": null,
"position": {
"x": 0,
"y": 0
},
"start_if": null,
"task_type": "scan",
"threshold": 95,
"conditions": null,
"phone_number": "",
"request_type": "GET"
},
"type": "basic",
"measured": {
"width": 272,
"height": 48
},
"parentId": null,
"position": {
"x": 0,
"y": 0
}
},
{
"id": "2",
"position": {
"x": 0,
"y": 150
},
"type": "basic",
"parentId": "1",
"data": {
"id": "2",
"position": {
"x": 0,
"y": 150
},
"parentId": "1",
"task_type": "slack",
"configs": {
"device": "Windows 10 PC",
"browser": "chrome",
"timeout": 300,
"interval": 1,
"location": "us",
"mask_ids": null,
"auto_height": true,
"end_on_fail": true,
"window_size": "1920,1080",
"create_issue": true,
"max_wait_time": 30,
"min_wait_time": 3,
"disable_animations": false
},
"conditions": null,
"start_if": null,
"maxNodes": 12,
"maxConds": 4,
"type": [
"html",
"logs",
"lighthouse",
"yellowlab",
"vrt"
],
"case_id": null,
"updates": null,
"threshold": 95,
"phone_number": "",
"email": "",
"uri": "",
"request_type": "GET",
"subject": "",
"message": "This is a test message",
"payload": "{}",
"headers": "{}"
},
"measured": {
"width": 272,
"height": 48
}
}
],
"edges": [
{
"id": "1",
"target": "2",
"source": "1",
"type": "smoothstep"
}
],
"time_last_run": null
}
Retrieve many Flows
This endpoint returns a paginated response with all Flows objects filtered by your account and ordered by time_created. This endpoint is useful when needing to displaying your flows in a table view for example. The limit parameter specifies the total number of objects you want returned per "group" (we recommend keeping this under 10 for best performance). The offset parameter specfies which "group" to return. For example, limit=10&offset=10 in a total dataset of 30 objects would return 10 flows in range flow #10 - flow #20.
GET - /flow?limit=10&offset=0
import requests, os
# import env vars
CURSION_API_BASE_URL = os.environ.get('CURSION_API_BASE_URL')
CURSION_API_TOKEN = os.environ.get('CURSION_API_TOKEN')
# setup configs
url = f'{BASE_URL}/flow?limit=10&offset=0'
headers = {
"content-type": "application/json",
"Authorization" : CURSION_API_TOKEN
}
# send the request
res = requests.get(
url=url,
headers=headers,
)
# retrieve response data
json_response = res.json()
print(json_response)
View Full Output
{
"count":30,
"next":"https://api.cursion.dev/v1/ops/flow?limit=10&offset=20",
"previous":"https://api.cursion.dev/v1/ops/flow?limit=10&offset=10",
"results":[
{
"id": "cc5a0ede-1aff-4eff-8040-9f4c0783f043",
"user": "dev@example.com",
"account": "8d4075a8-5ba0-48c9-9735-b989595edad5",
"time_created": "2024-11-15T17:41:21.464269Z",
"title": "Dual Step Flow",
"nodes": [
{
"id": "1",
"data": {
"id": "1",
"uri": "",
"type": [
"html",
"logs",
"lighthouse",
"yellowlab",
"vrt"
],
"email": "",
"case_id": null,
"configs": {
"device": "Windows 10 PC",
"browser": "chrome",
"timeout": 300,
"interval": 1,
"location": "us",
"mask_ids": "",
"auto_height": true,
"end_on_fail": true,
"window_size": "1920,1080",
"create_issue": true,
"max_wait_time": 30,
"min_wait_time": 3,
"disable_animations": false
},
"headers": "{}",
"message": "",
"payload": "{}",
"subject": "",
"updates": null,
"maxConds": 4,
"maxNodes": 12,
"parentId": null,
"position": {
"x": 0,
"y": 0
},
"start_if": null,
"task_type": "scan",
"threshold": 95,
"conditions": null,
"phone_number": "",
"request_type": "GET"
},
"type": "basic",
"measured": {
"width": 272,
"height": 48
},
"parentId": null,
"position": {
"x": 0,
"y": 0
}
},
{
"id": "2",
"position": {
"x": 0,
"y": 150
},
"type": "basic",
"parentId": "1",
"data": {
"id": "2",
"position": {
"x": 0,
"y": 150
},
"parentId": "1",
"task_type": "slack",
"configs": {
"device": "Windows 10 PC",
"browser": "chrome",
"timeout": 300,
"interval": 1,
"location": "us",
"mask_ids": null,
"auto_height": true,
"end_on_fail": true,
"window_size": "1920,1080",
"create_issue": true,
"max_wait_time": 30,
"min_wait_time": 3,
"disable_animations": false
},
"conditions": null,
"start_if": null,
"maxNodes": 12,
"maxConds": 4,
"type": [
"html",
"logs",
"lighthouse",
"yellowlab",
"vrt"
],
"case_id": null,
"updates": null,
"threshold": 95,
"phone_number": "",
"email": "",
"uri": "",
"request_type": "GET",
"subject": "",
"message": "This is a test message",
"payload": "{}",
"headers": "{}"
},
"measured": {
"width": 272,
"height": 48
}
}
],
"edges": [
{
"id": "1",
"target": "2",
"source": "1",
"type": "smoothstep"
}
],
"time_last_run": null
},
### SHORTENED FOR DISPLAY PURPOSES ###
]
}
Delete a Flow
Caution
Please use caution with this endpoint as it is irreversible.
DELETE - /flow/<flow:id>
import requests, os
# import env vars
CURSION_API_BASE_URL = os.environ.get('CURSION_API_BASE_URL')
CURSION_API_TOKEN = os.environ.get('CURSION_API_TOKEN')
# setup configs
url = f'{BASE_URL}/flow/<flow:id>'
headers = {
"content-type": "application/json",
"Authorization" : CURSION_API_TOKEN
}
# send the request
res = requests.delete(
url=url,
headers=headers,
)
# retrieve response data
json_response = res.json()
print(json_response)
View Full Output
{
"message": "flow deleted successfully"
}
