Skip to content

Commit 4bdfa84

Browse files
committed
refactor: move DHT Routing API after IPNS API
reorganize sections for better logical flow: - Content Routing API - Peer Routing API - IPNS API - DHT Routing API (moved here)
1 parent b278b84 commit 4bdfa84

File tree

1 file changed

+44
-44
lines changed

1 file changed

+44
-44
lines changed

src/routing/http-routing-v1.md

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,50 @@ The client SHOULD be able to make a request with `Accept: application/x-ndjson`
200200

201201
Each object in the `Peers` list is a record conforming to the [Peer Schema](#peer-schema).
202202

203+
## IPNS API
204+
205+
### `GET /routing/v1/ipns/{name}`
206+
207+
#### Path Parameters
208+
209+
- `name` is the :ref[IPNS Name] to resolve, encoded as CIDv1.
210+
211+
#### Response Status Codes
212+
213+
- `200` (OK): the response body contains the :ref[IPNS Record] for the given :ref[IPNS Name].
214+
- `404` (Not Found): must be returned if no matching records are found.
215+
- `406` (Not Acceptable): requested content type is missing or not supported. Error message returned in body should inform the user to retry with `Accept: application/vnd.ipfs.ipns-record`.
216+
217+
#### Response Headers
218+
219+
- `Etag`: a globally unique opaque string used for HTTP caching. MUST be derived from the protobuf record returned in the body.
220+
- `Cache-Control: public, max-age={ttl}, public, stale-while-revalidate={sig-ttl}, stale-if-error={sig-ttl}`: meaningful cache TTL returned with :ref[IPNS Record]
221+
- The `max-age` value in seconds SHOULD match duration from `IpnsEntry.data[TTL]`, if present and bigger than `0`. Otherwise, implementation SHOULD default to `max-age=60`.
222+
- Implementations SHOULD include `sig-ttl`, set to the remaining number of seconds the returned IPNS Record is valid.
223+
- `Expires:`: an HTTP-date timestamp ([RFC9110, Section 5.6.7](https://www.rfc-editor.org/rfc/rfc9110#section-5.6.7)) when the validity of IPNS Record expires (if `ValidityType=0`, when signature expires)
224+
- `Last-Modified`: an HTTP-date timestamp of when cacheable resolution occurred: allows HTTP proxies and CDNs to support inexpensive update checks via `If-Modified-Since`
225+
- `Vary: Accept`: allows intermediate caches to play nicely with the different possible content types.
226+
227+
#### Response Body
228+
229+
The response body contains a :ref[IPNS Record] serialized using the verifiable [`application/vnd.ipfs.ipns-record`](https://www.iana.org/assignments/media-types/application/vnd.ipfs.ipns-record) protobuf format.
230+
231+
### `PUT /routing/v1/ipns/{name}`
232+
233+
#### Path Parameters
234+
235+
- `name` is the :ref[IPNS Name] to publish, encoded as CIDv1.
236+
237+
#### Request Body
238+
239+
The content body must be a [`application/vnd.ipfs.ipns-record`][application/vnd.ipfs.ipns-record] serialized :ref[IPNS Record], with a valid signature matching the `name` path parameter.
240+
241+
#### Response Status Codes
242+
243+
- `200` (OK): the provided :ref[IPNS Record] was published.
244+
- `400` (Bad Request): the provided :ref[IPNS Record] or :ref[IPNS Name] are not valid.
245+
- `406` (Not Acceptable): submitted content type is not supported. Error message returned in body should inform the user to retry with `Content-Type: application/vnd.ipfs.ipns-record`.
246+
203247
## DHT Routing API
204248

205249
### `GET /routing/v1/dht/closest/peers/{peer-id}?[closerThan]&[count]`
@@ -256,50 +300,6 @@ The client SHOULD be able to make a request with `Accept: application/x-ndjson`
256300

257301
Each object in the `Peers` list is a record conforming to the [Peer Schema](#peer-schema).
258302

259-
## IPNS API
260-
261-
### `GET /routing/v1/ipns/{name}`
262-
263-
#### Path Parameters
264-
265-
- `name` is the :ref[IPNS Name] to resolve, encoded as CIDv1.
266-
267-
#### Response Status Codes
268-
269-
- `200` (OK): the response body contains the :ref[IPNS Record] for the given :ref[IPNS Name].
270-
- `404` (Not Found): must be returned if no matching records are found.
271-
- `406` (Not Acceptable): requested content type is missing or not supported. Error message returned in body should inform the user to retry with `Accept: application/vnd.ipfs.ipns-record`.
272-
273-
#### Response Headers
274-
275-
- `Etag`: a globally unique opaque string used for HTTP caching. MUST be derived from the protobuf record returned in the body.
276-
- `Cache-Control: public, max-age={ttl}, public, stale-while-revalidate={sig-ttl}, stale-if-error={sig-ttl}`: meaningful cache TTL returned with :ref[IPNS Record]
277-
- The `max-age` value in seconds SHOULD match duration from `IpnsEntry.data[TTL]`, if present and bigger than `0`. Otherwise, implementation SHOULD default to `max-age=60`.
278-
- Implementations SHOULD include `sig-ttl`, set to the remaining number of seconds the returned IPNS Record is valid.
279-
- `Expires:`: an HTTP-date timestamp ([RFC9110, Section 5.6.7](https://www.rfc-editor.org/rfc/rfc9110#section-5.6.7)) when the validity of IPNS Record expires (if `ValidityType=0`, when signature expires)
280-
- `Last-Modified`: an HTTP-date timestamp of when cacheable resolution occurred: allows HTTP proxies and CDNs to support inexpensive update checks via `If-Modified-Since`
281-
- `Vary: Accept`: allows intermediate caches to play nicely with the different possible content types.
282-
283-
#### Response Body
284-
285-
The response body contains a :ref[IPNS Record] serialized using the verifiable [`application/vnd.ipfs.ipns-record`](https://www.iana.org/assignments/media-types/application/vnd.ipfs.ipns-record) protobuf format.
286-
287-
### `PUT /routing/v1/ipns/{name}`
288-
289-
#### Path Parameters
290-
291-
- `name` is the :ref[IPNS Name] to publish, encoded as CIDv1.
292-
293-
#### Request Body
294-
295-
The content body must be a [`application/vnd.ipfs.ipns-record`][application/vnd.ipfs.ipns-record] serialized :ref[IPNS Record], with a valid signature matching the `name` path parameter.
296-
297-
#### Response Status Codes
298-
299-
- `200` (OK): the provided :ref[IPNS Record] was published.
300-
- `400` (Bad Request): the provided :ref[IPNS Record] or :ref[IPNS Name] are not valid.
301-
- `406` (Not Acceptable): submitted content type is not supported. Error message returned in body should inform the user to retry with `Content-Type: application/vnd.ipfs.ipns-record`.
302-
303303
## Pagination
304304

305305
This API does not support pagination, but optional pagination can be added in a backwards-compatible spec update.

0 commit comments

Comments
 (0)