block_put

/api/v0/block/put

Store input as an IPFS block.

REQUEST

1
POST https://ipfs.infura.io::5001/api/v0/block/put?format=v0&mhtype=sha2-256&mhlen=-1
Copied!

REQUEST PARAMS

  • file [Required] - The path to a file to be added to IPFS.
  • format [Optional] - cid format for blocks to be created with. Default: “v0”.
  • mhtype [Optional] - multihash hash function. Default: “sha2-256”.
  • mhlen [Optional] - multihash hash length. Default: “-1”.

EXAMPLE

Argument 'file' is of file type. This endpoint expects a file in the body of the request as multipart/form-data.
1
// POST
2
curl "https://ipfs.infura.io:5001/api/v0/block/put" \
3
-X POST \
4
-H "Content-Type: multipart/form-data" \
5
-F file=@"/purpink.jpeg"
Copied!

RESPONSE

On success, the call to this endpoint will return with 200 and the following body:

RESULT FIELDS

  • Key - Key of the block
  • Size - integer indication size in bytes

BODY

1
{
2
"Key": "QmaYL7E4gDTPNfLxrCEEEcNJgcHBJ55NxxTnxpDKWqMtJ3",
3
"Size": 2392
4
}
Copied!
Last modified 3mo ago