JS / Docker example code
Last updated
Last updated
Welcome to the Akave Link API! This API wrapper enables seamless integration with Akave's decentralized storage network. Below, you’ll find quick setup steps, examples of how to use each API endpoint with JavaScript, and equivalent curl
commands.
Github repo for reference : https://github.com/akave-ai/akavelink
Installing docker : https://docs.docker.com/engine/install/
To start, pull the Akave Link Docker image:
Visit https://faucet.akave.ai to obtain a wallet address and add the Akave chain to MetaMask.
Request funds from the faucet to start experimenting with the Akave Link API.
Always be careful when dealing with your private key. Double-check that you’re not hardcoding it anywhere or committing it to Git. Remember: anyone with access to your private key has complete control over your funds.
Ensure you’re not reusing a private key that’s been deployed on other EVM chains. Each blockchain has its own attack vectors, and reusing keys across chains exposes you to cross-chain vulnerabilities. Keep separate keys to maintain isolation and protect your assets.
Run the container and specify the PRIVATE_KEY
environment variable:
With Akavelink we expect you to use the blockchain enabled storage network on port 5500
Node Address Public endpoint ( NODE_ADDRESS ) -> connect.akave.ai:5500
The API will now be running locally at http://localhost:8000
.
Here's a quick setup to interact with the Akave API using JavaScript:
Each section below demonstrates API calls using this wrapper, alongside the curl
equivalent.
Each section below demonstrates API calls using this wrapper, alongside the curl
equivalent.
Create a new storage bucket.
JavaScript Example:
curl
Command:
Retrieve all existing buckets.
JavaScript Example:
curl
Command:
Retrieve details of a specific bucket.
JavaScript Example:
curl
Command:
Retrieve a list of files within a bucket.
JavaScript Example:
curl
Command:
Fetch metadata about a specific file.
JavaScript Example:
curl
Command:
Upload a file to a bucket.
Make sure the minimum file size is 127 bytes! Keep max size to test at 100MB
JavaScript Example (using FormData):
curl
Command:
Download a file from a bucket.
JavaScript Example:
You can download the file directly in your browser or provide a download url with a public hosted API by using:
http(s)://ip-or-dns-name/buckets/:BucketName/files/:FileName/download
curl
Command:
Output file extention should be the same as the requested file.
All endpoints return errors in the following format:
Ensure you handle these responses in your code to capture and process errors effectively.