object_put

/api/v0/object/put

Store input as a DAG object, print its key.

REQUEST

1
POST http://ipfs.infura:5001/api/v0/object/put?inputenc=json&datafieldenc=text&pin=false
Copied!

REQUEST PARAMS

  • file [Required] - the file to be stored as a DAG object.
  • inputenc [Optional] - Encoding type of input data. One of: {“protobuf”, “json”}. Default: “json”.
  • datafieldenc [Optional] - Encoding type of the data field, either “text” or “base64”. Default: “text”.
  • pin [Optional] - Pin this object when adding. Default: “false”.

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/object/put?inputenc=json&datafieldenc=text&pin=false" \
3
-X POST \
4
-H "Content-Type: multipart/form-data" \
5
-F file=@"node.json"
Copied!

RESPONSE

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

RESULT FIELDS

  • Hash - Hash of the object

BODY

1
{
2
"Hash": "QmZZmY4KCu9r3e7M2Pcn46Fc5qbn6NpzaAGaYb22kbfTqm"
3
}
Copied!