API References Private IPFS for NFT
Add
Request Body
This endpoint expects one or several files (depending on the command) in the body of the request as 'multipart/form-data'.
The add
command not only allows adding files, but also uploading directories and complex hierarchies.
This happens as follows: Every part in the multipart request is a directory or a file to be added to IPFS.
Directory parts have a special content type application/x-directory
. These parts do not carry any data. The part headers look as follows:
Copy Content-Disposition: form-data; name="file"; filename="folderName"
Content-Type: application/x-directory
File parts carry the file payload after the following headers:
Copy Abspath: /absolute/path/to/file.txt
Content-Disposition: form-data; name="file"; filename="folderName%2Ffile.txt"
Content-Type: application/octet-stream
...contents...
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.
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.
Example
Request Response
Copy curl -X 'POST' \
'{endpoint}/ipfs/add' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o' \
-H 'Content-Type: multipart/form-data' \
-F 'file=@file.yaml'
Copy {
"cid": "QmVuLWZ1cmZiujoM9y6r6nd19x9kVEARYa9NABzf6GbxRN"
}
Cat
Example
Request Response
Copy curl -X 'GET' \
'{endpoint}/ipfs/QmVuLWZ1cmZiujoM9y6r6nd19x9kVEARYa9NABzf6GbxRN' \
-H 'accept: text/plain' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o'
Get
Example
Request Response
Copy curl -X 'GET' \
'{endpoint}/ipfs/QmVuLWZ1cmZiujoM9y6r6nd19x9kVEARYa9NABzf6GbxRN/get?filename=temp' \
-H 'accept: application/x-tar' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o'
Id
Example
Request Response
Copy curl -X 'GET' \
'{endpoint}/ipfs/id' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o'
Copy {
"id": "12D3KooWN4tTkHvjMttH77tMtcTBz5HJqEfNveJsnDo828JjHcjL"
}
Version
Example
Request Response
Copy curl -X 'GET' \
'{endpoint}/ipfs/version' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o'
Copy {
"version": "0.10.0"
}
Last updated 5 months ago