Banner for Base URL APIs

Base URL APIs

ipfsweb3

Sharing a link to a directory of files is powerful and easy

J Chris AndersonFeb 15, 2022

It feels good to discover a new style of API. A lot of the time APIs come into use before people give them a commonly agreed name. Webhooks and serverless are both examples. Lately I see lots of cool uses for a directory of files shared at a URL. For instance, a directory is the output of a Hugo, Next.js, React or other frontend static HTML build, and the basis of a JAMStack app deploy to serverless hosts like Github Pages, Netlify and Vercel. A directory of files is also the expectation for smart contracts minting NFT metadata and assets. For instance the OpenSea smart contract example implements tokenURI as the concatenation of baseTokenURI and tokenID. This way the NFTs in a large drop share the same base URL, so it’s easy for the smart contract to link to metadata and assets based on tokenID.

Sharing a link to a directory of data is a basic pattern so we shouldn’t be surprised to see it show up again and again. It’s different from uploading data, because it allows you to take advantage of existing copies of the data. Because it is as much about the data structure as copying the files, it promotes common formats, and also allows data consumers to provide services to data holders without implementing a complex upload and data custody pipeline. (As with everything, what I’m describing is easier with public data like NFTs. Private data is left as an exercise for the reader...)

It's little affordances like this which can make a big difference in the industry. If the easiest way to accept data from users is via a base URL, that is a thumb on the scale for user's data ownership, interoperability and reuse. Sites that accept a URL of uploads benefit from accepting similar data formats as competitive sites. By reusing the upload format, developers not only save time, but can utilize open source data handling libraries, etc. All this means developers can spend more time working on features that distinguish their app.

All this has been possible for years. What’s new today is that with content addressable systems like IPFS you don’t have to trust a third party, or control a data repository in the cloud, to upload verifiable data to the network and share the link with service providers. IPFS URLs make up a significant fraction of the assets and metadata in today’s NFTs, as the market sees the value in the verifiable storage that CIDs provide. Content-based identifiers are locked to their content, so any on-chain references can be cryptographically trusted. This makes a shared upload URL as good as sending the files directly.

Even without cryptographic CIDs, a URL to a directory full of content is a valuable baseline abstraction. Users can easily arrange their files in the format expected of the service, whether that is for a static HTML app deploy, or a 10k drop. This separates the value from the toolchain, so even beginners can produce the output format, and begin contributing even while they are learning. This shares some of the accesiblity benefits of “view source,” lowering the barrier to entry for new developers and users to understand the system.

The common baseline, a reusable copy of data in the cloud, enables sharing across services. So the user can upload an app or an NFT once, and import it into different contexts as they learn. As this base URL style gets popularized, you can imagine multiple gallery apps competing to be the best way to display the content from a standard photo library upload. Or a creative application’s saved directory of multimedia records turning into a standard input format for a multimedia projection ecosystem, all enabled by easy access to data living in predictable directory structures and shared using a base URL.

Big data interchange is a messy enterprise. Almost every project starts with acquiring the data, and ends with sharing the data. Uploading a ton of files takes time, so you want to make it worth while. If we use the base URL pattern, users can revel in the fact that resharing data that’s already online is way faster than uploading thousands of files again. Data living in web3 will offer users a new sense of ownership. As we’ve seen with NFTs, a sense of ownership creates all kinds of cool incentives. I can’t wait to see what we build!