ipfs / infra

Tools and systems for the IPFS community

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enable `/api/v0/cid` at ipfs.io

lidel opened this issue · comments

We already expose public endpoint for DNSLink lookups:
https://ipfs.io/api/v0/dns/docs.ipfs.io

However, there is no endpoint for converting any CID to cidv1base32:
https://ipfs.io/api/v0/cid/base32?arg=QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR
(returns 404 atm)

Expected result:

$ curl 'http://localhost:5001/api/v0/cid/base32?arg=QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR'
{"CidStr":"QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR","Formatted":"bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi","ErrorMsg":""}

@olizilla Can we unblock /api/v0/cid at the gateway?

yes we caaaaaan

$ curl -s -X POST 'https://ipfs.io/api/v0/cid/base32?arg=QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR' | jq                                                     fix-ipn.io-redirect
{
  "CidStr": "QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR",
  "Formatted": "bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi",
  "ErrorMsg": ""
}

note: this is only enabled on HTTPS, not HTTP.