Dag Operations
resource: dag — 6 operations on the IPLD merkle-DAG layer
dag operations understand IPLD codecs (dag-json, dag-cbor)
and can walk/resolve paths through linked data. block operations (next page) are one layer
lower — raw bytes addressed by CID, with no codec awareness.
get
| Field | Type | Required | Default |
|---|---|---|---|
cidPath | text | ✓ Yes | — |
outputCodec | text | No | dag-json |
Missing path → CFG_MISSING_CID_PATH. Response: { cid, data } — data
is the dag-json text body, passed through verbatim (no binary handling needed).
put
Binary input.
| Field | Type | Required | Default |
|---|---|---|---|
inputDataKey | text | No | data |
dataMode | select | No | base64 (or text) |
inlineContent | text | No | — |
codec | text | No | dag-json — store codec (also dag-cbor, raw) |
inputCodec | text | No | dag-json |
pin | bool | No | false |
hash | text | No | sha2-256 |
Content resolved from InputData[inputDataKey], else inlineContent; empty →
MISSING_CONTENT, bad base64 → INVALID_CONTENT_ENCODING. Response: { cid
}.
resolve
| Field | Type | Required |
|---|---|---|
ipldPath | text | ✓ Yes |
Missing path → CFG_MISSING_IPLD_PATH. Response: { cid, remainderPath } — the
terminal CID plus any unconsumed path segment.
import
Binary input (CAR archive).
| Field | Type | Required | Default |
|---|---|---|---|
inputDataKey | text | No | data |
dataMode | select | No | base64 |
inlineContent | text | No | — |
pinRoots | bool | No | true |
localOnly | bool | No | false |
stats | bool | No | false |
List-shaped output: count = number of imported roots; when stats=true also
blockCount and blockBytesCount. Each item: { cid, pinned,
pinErrorMessage } — pinned: false means the block imported but its pin failed.
export
Binary output (CAR archive).
| Field | Type | Required | Default |
|---|---|---|---|
cid | text | ✓ Yes | — |
localOnly | bool | No | false — export only locally-present blocks; fail rather than fetch remotely |
Missing cid → CFG_MISSING_CID. Response: { cid, data, size, fileName, mimeType } —
data is the raw CAR-archive byte[]. The read stream's trailer is checked for a
trailing error before the bytes are trusted complete.
stat
| Field | Type | Required |
|---|---|---|
cid | text | ✓ Yes |
Missing cid → CFG_MISSING_CID. Response: { cid, size, blockCount } — a single
final aggregate, not incremental progress events.