# Shortest chain of links between two sets of notes (each `{"paths": [...]}` and/or

`POST /datanotes/operations/graph_path/` (operation `graph_path`)

Shortest chain of links between two sets of notes (each `{"paths": [...]}` and/or
`{"table", "where"}`): `found`, `length` and `path`: the steps (`from`, `label`, `direction`, `to`).
`direction` both by default; `max_depth` default 6 (max 10).

## Request body

`application/json`, required

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `from_nodes` | `object` | yes |  |  |
| `to_nodes` | `object` | yes |  |  |
| `direction` | `"out" \| "in" \| "both" \| null` | no | `null` |  |
| `edges` | `string[] \| null` | no | `null` |  |
| `max_depth` | `integer \| null` | no | `null` |  |

## Responses

| Status | Description | Body |
| --- | --- | --- |
| 200 | Done. | `object` (application/json) |
| 400 | Bad input: the body is not a JSON object, or an argument is unknown, missing or of the wrong type. | `Error` (application/json) |
| 401 | Missing or wrong bearer token. | `Error` (application/json) |
| 404 | Unknown table, view, migration, note or folder. | `Error` (application/json) |
| 409 | Ambiguous table name: it matches several tables (`paths` or `tables` lists them). | `AmbiguousName` (application/json) |
| 500 | Unexpected error. | `Error` (application/json) |

The schemas named here are in [openapi.json](https://datanotes.dev/openapi.json) (`components.schemas`).
