Skip to content

Breadth-first walk over links from `from_nodes` (`{"paths": [...]}` and/or `{"table", "where"}`).

POST
/datanotes/operations/graph_traverse/
curl --request POST \
--url https://example.com/datanotes/operations/graph_traverse/ \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "from_nodes": {}, "direction": null, "edges": null, "tables": null, "through": null, "min_depth": null, "max_depth": null, "limit": null }'

Breadth-first walk over links from from_nodes ({"paths": [...]} and/or {"table", "where"}).

  • direction: out (default, follow links), in (follow backlinks) or both.
  • edges: edge labels to follow (link columns such as people, event, or link).
  • tables: return only notes of these tables; through: only walk on through these tables.
  • min_depth (default 1) / max_depth (default 2, max 10), limit (default 500).

Each node comes with depth and via (one shortest route). Example — moods tied to events with Alice: from {"table": "person", "where": {"name": "Alice"}}, direction in, edges ["people", "event"], tables ["mood"], max_depth 2. Feed the paths to select_rows with where: {"path": {"in": [...]}} to aggregate them.

Media typeapplication/json
object
from_nodes
required
object
key
additional properties
any
direction
Any of:
string
Allowed values: out in both
edges
Any of:
Array<string>
tables
Any of:
Array<string>
through
Any of:
Array<string>
min_depth
Any of:
integer
max_depth
Any of:
integer
limit
Any of:
integer

Done.

Media typeapplication/json
object
start
required

Start notes.

Array<string>
nodes
required

Notes reached, by depth.

Array<object>
object
path
required
string
table
string
depth
required
integer
via
required

One shortest route from a start note.

Array<object>
GraphStep

One link followed.

object
from
required

Note path the step starts at.

string
label
required

Edge label: the link column, or link for other links.

string
direction
required

Out: from links to to; in: to links to from.

string
Allowed values: out in
to
required

Note path reached.

string
truncated
required

limit was reached.

boolean

Example

{
"nodes": [
{
"via": [
{
"direction": "out"
}
]
}
]
}

Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type.

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}

Missing or wrong bearer token.

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}

Unknown table, view, migration, note or folder.

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}

Ambiguous table name: it matches several tables (paths or tables lists them).

Media typeapplication/json
object
error
required
string
paths

The tables’ folders the name matches.

Array<string>
tables

The qualified tables the name matches.

Array<string>

Example generated

{
"error": "example",
"paths": [
"example"
],
"tables": [
"example"
]
}

Unexpected error.

Media typeapplication/json
object
error
required

What went wrong, for a person or an agent.

string

Example generated

{
"error": "example"
}