Skip to content

Commit b183a51

Browse files
committed
docs: /api/v0/add curl example
cleanup
1 parent c134198 commit b183a51

File tree

4 files changed

+30
-12
lines changed

4 files changed

+30
-12
lines changed

docs/reference/kubo/rpc.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ I AM SERIOUS, DO NOT EDIT ANYTHING BELOW ;-D
4747
4848
-->
4949

50-
::: tip Generated on 2025-03-25, from kubo v0.34.1
50+
::: tip Generated on 2025-03-28, from kubo v0.34.1
5151
This document was autogenerated from [v0.34.1](https://github.com/ipfs/kubo/releases/tag/v0.34.1).
5252
For issues and support, check out the [http-api-docs](https://github.com/ipfs/ipfs-docs/tree/main/tools/http-api-docs) generator on GitHub.
5353
:::
@@ -209,6 +209,12 @@ Argument `path` is of file type. This endpoint expects one or several files (dep
209209

210210
The `add` command not only allows adding files, but also uploading directories and complex hierarchies.
211211

212+
For example, to upload multiple files and have them show up in a specific folder structure:
213+
214+
```
215+
curl -sLk -XPOST -F "[email protected];filename=path1/file1.txt" -F \[email protected];filename=path2/file2.txt" "http://127.0.0.1:5001/api/v0/add?recursive=true&wrap-with-directory=true"
216+
```
217+
212218
This happens as follows: Every part in the multipart request is a *directory* or a *file* to be added to IPFS.
213219

214220
Directory parts have a special content type `application/x-directory`. These parts do not carry any data. The part headers look as follows:
@@ -230,7 +236,8 @@ Content-Type: application/octet-stream
230236

231237
The above file includes its path in the "folderName/file.txt" hierarchy and IPFS will therefore be able to add it inside "folderName". The parts declaring the directories are optional when they have files inside and will be inferred from the filenames. In any case, a depth-first traversal of the directory tree is recommended to order the different parts making the request.
232238

233-
The `Abspath` header is included for filestore/urlstore features that are enabled with the `nocopy` option and it can be set to the location of the file in the filesystem (within the IPFS root), or to its full web URL.
239+
NOTE: The `Abspath` header is included for experimental filestore/urlstore features that are enabled with the `nocopy` option and it can be set to the location of the file in the filesystem (within the IPFS root), or to its full web URL.
240+
234241

235242

236243
### Response

package-lock.json

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,12 @@
4646
"useTabs": false
4747
},
4848
"lint-staged": {
49-
"*.{js,json,css,less,scss,html,md,vue}": ["prettier --write"],
50-
"*.styl": ["stylus-supremacy format --replace"]
49+
"*.{js,json,css,less,scss,html,md,vue}": [
50+
"prettier --write"
51+
],
52+
"*.styl": [
53+
"stylus-supremacy format --replace"
54+
]
5155
},
5256
"husky": {
5357
"hooks": {

tools/http-api-docs/markdown.go

+9-2
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,13 @@ Argument `+"`%s`"+` is of file type. This endpoint expects one or several files
350350
if bodyArg.Endpoint == "/api/v0/add" {
351351
fmt.Fprintln(buf, `
352352
353-
The `+"`add`"+` command not only allows adding files, but also uploading directories and complex hierarchies. (For example, in cURL, you can upload multiple files and have them show up in a folder by running `+"`curl -sLk -XPOST -F \"[email protected];filename=path1/file1.txt\" -F \"[email protected];filename=path2/file2.txt\" \"http://127.0.0.1:5001/api/v0/add?recursive=true&wrap-with-directory=true\"`"+`; -F is specified multiple times along with recursive and wrap-with-directory.)
353+
The `+"`add`"+` command not only allows adding files, but also uploading directories and complex hierarchies.
354+
355+
For example, to upload multiple files and have them show up in a specific folder structure:
356+
357+
`+"```"+`
358+
curl -sLk -XPOST -F "[email protected];filename=path1/file1.txt" -F \[email protected];filename=path2/file2.txt" "http://127.0.0.1:5001/api/v0/add?recursive=true&wrap-with-directory=true"
359+
`+"```"+`
354360
355361
This happens as follows: Every part in the multipart request is a *directory* or a *file* to be added to IPFS.
356362
@@ -373,7 +379,8 @@ Content-Type: application/octet-stream
373379
374380
The above file includes its path in the "folderName/file.txt" hierarchy and IPFS will therefore be able to add it inside "folderName". The parts declaring the directories are optional when they have files inside and will be inferred from the filenames. In any case, a depth-first traversal of the directory tree is recommended to order the different parts making the request.
375381
376-
The `+"`Abspath`"+` header is included for filestore/urlstore features that are enabled with the `+"`nocopy`"+` option and it can be set to the location of the file in the filesystem (within the IPFS root), or to its full web URL.
382+
NOTE: The `+"`Abspath`"+` header is included for experimental filestore/urlstore features that are enabled with the `+"`nocopy`"+` option and it can be set to the location of the file in the filesystem (within the IPFS root), or to its full web URL.
383+
377384
`)
378385
}
379386
return buf.String()

0 commit comments

Comments
 (0)