Ipfs-cluster add metadata using http API

I try to add metadata to a pinned file in ipfs-cluster via the HTTP API but could not succeed so far. Via the client it seems to work as described in the test. Does anyone have an idea?

I supposed it should work somehow like this:

curl -X POST http://<cluster-host>:9094/pins/<cid>/metadata -H "Content-Type: application/json" -d '{
    "key1": "value1",
    "key2": "value2"
}'

Why did you suppose that?

The documentation explains how to figure this and everything else out.

I got the idea, because in the api.go, there’s a definition of
Metadata: make(map[string]string),, but in the documentation that you linked and other documentation, I can’t find the handler for the metadata. Therefore my confusion, sorry I am still a bit new to ipfs cluster.

If you do what the documentation says (using ipfs-cluster-ctl --debug) you will see that the metadata is set via query-string options on the pin request.

1 Like

Thank you, this did the trick. I couldn’t find this in the documentation, so I opened a PR on the website to state this flag more prominently. Hope it helps!