API References
Private IPFS for NFT
Add
Make a directory for including the file
POST /v1/ipfs/add HTTP/1.1
Host: test1-api.vixco.net
Authorization: Bearer JWT
Content-Type: multipart/form-data
Accept: */*
Content-Length: 17
{
"file": "binary"
}
Add a file or directory to IPFS
{
"cid": "text"
}
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:
Content-Disposition: form-data; name="file"; filename="folderName"
Content-Type: application/x-directory
File parts carry the file payload after the following headers:
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
curl -X 'POST' \
'{endpoint}/ipfs/add' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o' \
-H 'Content-Type: multipart/form-data' \
-F '[email protected]'
Cat
The content ID to the IPFS object(s) to be outputted
The sub path of the IPFS object(s)
GET /v1/ipfs/{cid} HTTP/1.1
Host: test1-api.vixco.net
Authorization: Bearer JWT
Accept: */*
Show IPFS object data
text
Example
curl -X 'GET' \
'{endpoint}/ipfs/QmVuLWZ1cmZiujoM9y6r6nd19x9kVEARYa9NABzf6GbxRN' \
-H 'accept: text/plain' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o'
Get
The content ID to the IPFS object(s) to be outputted
The filename to be saved. If omitted, CID is used
GET /v1/ipfs/{cid}/get HTTP/1.1
Host: test1-api.vixco.net
Authorization: Bearer JWT
Accept: */*
Save IPFS object data
binary
Example
curl -X 'GET' \
'{endpoint}/ipfs/QmVuLWZ1cmZiujoM9y6r6nd19x9kVEARYa9NABzf6GbxRN/get?filename=temp' \
-H 'accept: application/x-tar' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o'
Id
Example
curl -X 'GET' \
'{endpoint}/ipfs/id' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o'
Version
Example
curl -X 'GET' \
'{endpoint}/ipfs/version' \
-H 'accept: application/json' \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MTExQGRzdGEuY29tIiwicm9sZSI6IlJPTEVfU1RPUkUiLCJleHAiOjE2NTIyNDY4ODIsImlhdCI6MTY1MjE2MDQ4Mn0.ceg6PQT9D78h9PtMZR9DrbfiXM3YfGAqUiGqDBNLo-o'