dag_put

/api/v0/dag/put

Add a dag node to IPFS.

REQUEST

1
POST -F file=@myfile "http://ipfs.infura.io:5001/api/v0/dag/put?store-codec=dag-cbor&input-codec=dag-json&pin=<value>&hash=sha2-256"
Copied!

REQUEST PARAMS

  • store-codec [string]: Codec that the stored object will be encoded with. Default: dag-cbor. Required: no.
  • input-codec [string]: Codec that the input object is encoded in. Default: dag-json. Required: no.
  • pin [bool]: Pin this object when adding. Required: no.
  • hash [string]: Hash function to use. Default: sha2-256. Required: no.

EXAMPLE

Argument file is of file type. This endpoint expects one or several files (depending on the command) in the body of the request as multipart/form-data.
1
// POST
2
curl "[email protected] "http://ipfs.infura.io:5001/api/v0/dag/put?store-codec=dag-cbor&input-codec=dag-json&pin=<value>&hash=sha2-256" \
3
-X POST \
4
-H "Content-Type: multipart/form-data" \
5
-F [email protected]"/sample-result.json"
Copied!

RESPONSE

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

RESULT FIELDS

  • Cid - Content ID (see more here)

BODY

1
{
2
"Cid": {
3
"/": "<cid-string>"
4
}
5
}
Copied!
Last modified 2mo ago