|
| 1 | +--- |
| 2 | +date: 2023-04-17 |
| 3 | +editors: |
| 4 | + - name: Henrique Dias |
| 5 | + github: hacdias |
| 6 | + url: https://hacdias.com/ |
| 7 | +--- |
| 8 | + |
| 9 | +# Writable Gateway Specification |
| 10 | + |
| 11 | +Writable Gateway is an extension of :cite[path-gateway], which allows data onboarding |
| 12 | +to IPFS via HTTP endpoints. This allows for more interoperability with the remaining |
| 13 | +of the web, and allows for more ways of adding data to IPFS. |
| 14 | + |
| 15 | +# HTTP API |
| 16 | + |
| 17 | +This API is a superset of the HTTP API of :cite[path-gateway]. The differences are |
| 18 | +documented below. The main difference is the introduction of a `POST` endpoint. |
| 19 | + |
| 20 | +## `POST /ipfs` |
| 21 | + |
| 22 | +Onboards new data to the IPFS node behind the gateway. The onboarded data can be |
| 23 | +of any of the following types and be specified via the `Content-Type` header: |
| 24 | + |
| 25 | +- [`application/vnd.ipld.raw`] - adds raw [blocks] to the gateway. The data in |
| 26 | +the request body is assumed to be pure blocks of data, with no specific structure. |
| 27 | +- [`application/vnd.ipld.car`] - adds a [CAR] to the gateway. The data in the request |
| 28 | +body is assumed to be a CAR file. |
| 29 | +- [`application/x-tar`] - adds a [TAR] archive to the gateway. The data in the request |
| 30 | +body is assumed to be a TAR archive containing a directory tree that will be added |
| 31 | +as a UnixFS directory to IPFS. |
| 32 | + |
| 33 | +In case of success, the request will return a `201 Created` status code, as |
| 34 | +well as a `Content-Location` header containing the content path of the newly added |
| 35 | +resource. |
| 36 | + |
| 37 | +[`application/vnd.ipld.raw`]: https://www.iana.org/assignments/media-types/application/vnd.ipld.raw |
| 38 | +[`application/vnd.ipld.car`]: https://www.iana.org/assignments/media-types/application/vnd.ipld.car |
| 39 | +[`application/x-tar`]: https://en.wikipedia.org/wiki/Tar_(computing) |
| 40 | +[blocks]: https://docs.ipfs.io/concepts/glossary/#block |
| 41 | +[CAR]: https://docs.ipfs.io/concepts/glossary/#car |
| 42 | +[TAR]: https://en.wikipedia.org/wiki/Tar_(computing) |
0 commit comments