web3.storage icon indicating copy to clipboard operation
web3.storage copied to clipboard

It should be possible to update/replace a pin with the same CID

Open 2color opened this issue 2 years ago • 1 comments

There are some cases where it's desired to update the name, meta, and origins fields of a pin request with a given CID using the replace pin endpoint.

Currently, the web3.storage pinning API returns the following 400 error when attempting to update those fields with the same CID.

https://github.com/web3-storage/web3.storage/blob/bfa88cbb330274b287de90ca7d4b244919f18a5f/packages/api/src/pins.js#L253-L256

Related: https://github.com/ipfs-shipyard/pinning-service-compliance/issues/124

2color avatar Jun 21 '22 15:06 2color

cc @mbommerez seems quick to add in the PSA v2 initiative

dchoi27 avatar Jul 18 '22 18:07 dchoi27

Scenario:

  • When you replace a Pin Request with the same CID but different metadata, we get an error.

We need to double check the API spec and try to replicate.

mbommerez avatar Nov 02 '22 15:11 mbommerez

There's some context here... Wating to get an answer from the team there. I wonder if we should go ahead anyway and have the replace always return a pin with the same requestid.

flea89 avatar Nov 15 '22 09:11 flea89

Discussed with @olizilla. We should go ahead and allow for update-like operations but still, keep the behavior consistent with the current implementation and compliance checks here for now. That means a new pin it's always created and a different requestid is returned by the endpoint.

We can then try to get some alignment and discuss an improved approach in the spec repo with the team.

flea89 avatar Nov 15 '22 16:11 flea89