From fce5f589caba57d8a9602fae14d42d53836dca98 Mon Sep 17 00:00:00 2001 From: wrvnnull <122137078+wrvnnull@users.noreply.github.com> Date: Fri, 28 Aug 2026 01:43:49 +0800 Subject: [PATCH 1/2] docs: fix /api/v0/dag/import response to JSONL (closes #1980) The endpoint returns a JSONL body (one JSON object per line), not a single JSON document. The Stats record only appears when stats=true. Updates the documented response example to match actual behavior. --- docs/reference/kubo/rpc.md | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/docs/reference/kubo/rpc.md b/docs/reference/kubo/rpc.md index d024bf7c8..a65f2dbe9 100644 --- a/docs/reference/kubo/rpc.md +++ b/docs/reference/kubo/rpc.md @@ -1131,24 +1131,15 @@ Argument `path` is of file type. This endpoint expects one or several files (dep ### Response -On success, the call to this endpoint will return with 200 and the following body: - -```json -{ - "Root": { - "Cid": { - "/": "" - }, - "PinErrorMsg": "" - }, - "Stats": { - "BlockBytesCount": "", - "BlockCount": "" - } -} +On success, the call to this endpoint will return with 200 and a +**JSONL** body (one JSON object per line, not a single JSON document): +```jsonl +{"Root":{"Cid":{"/":""},"PinErrorMsg":"string"}} +{"Stats":{"BlockCount":,"BlockBytesCount":}} ``` +The `Stats` record is only present when the `stats=true` argument is provided. ### cURL Example `curl -X POST -F file=@myfile "http://127.0.0.1:5001/api/v0/dag/import?pin-roots=&local-only=&silent=&stats=&fast-provide-root=&fast-provide-dag=&fast-provide-wait=&allow-big-block=false"` From bfaa5b08bc490a95a7cca388865879d706435e9a Mon Sep 17 00:00:00 2001 From: wrvnnull <122137078+wrvnnull@users.noreply.github.com> Date: Fri, 28 Aug 2026 01:55:49 +0800 Subject: [PATCH 2/2] docs: document the DHT query 'Type' integer values (closes #1260) The `/api/v0/dht/query` response `Type` field was never explained. Add a table mapping the integer to its go-libp2p routing query event (SendingQuery / PeerResponse / FinalPeer / QueryError) and link to the authoritative definition. --- docs/reference/kubo/rpc.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/reference/kubo/rpc.md b/docs/reference/kubo/rpc.md index a65f2dbe9..9862fee60 100644 --- a/docs/reference/kubo/rpc.md +++ b/docs/reference/kubo/rpc.md @@ -5006,6 +5006,17 @@ On success, the call to this endpoint will return with 200 and the following bod ``` +The `Type` field is an integer that indicates the kind of DHT query event: + +| Value | Meaning | +| ----- | ------- | +| `0` | `SendingQuery` — the query is being sent to a peer | +| `1` | `PeerResponse` — a peer responded with its closest peers | +| `2` | `FinalPeer` — the peer is the closest found to the target | +| `3` | `QueryError` — the query to a peer failed | + +See the [go-libp2p routing query type definitions](https://github.com/libp2p/go-libp2p/core/routing/query.go) for the authoritative list. + ### cURL Example `curl -X POST "http://127.0.0.1:5001/api/v0/dht/query?arg=&verbose="`