API
ShdwDrive exposes an API that you can interact directly without the need of the CLI or SDK. You may build on top of these methods.
Contents
storage-account
POST
https://shadow-storage.genesysgo.net
Creates a new storage account
Request content type: application/json
Request Body
Name | Type | Description |
---|---|---|
transaction* | Serialized create storage account transaction that's partially signed by the storage account owner |
storage-account-info
POST
https://shadow-storage.genesysgo.net
Gets on-chain and ShdwDrive Network data about a storage account
Request content type: application/json
Request Body
Name | Type | Description |
---|---|---|
storage_account* | String | Publickey of the storage account you want to get information for |
upload
POST
https://shadow-storage.genesysgo.net
Uploads a single file or multiple files at once Request content type: multipart/form-data Example Implementation
Parameters (FormData fields)
Request Body
Name | Type | Description |
---|---|---|
file* | The file you want to upload. You may add up to 5 files each with a field name of
. | |
message* | String | Base58 message signature. |
signer* | String | Publickey of the signer of the message signature and owner of the storage account |
storage_account* | String | Key of the storage account you want to upload to |
edit
POST
https://shadow-storage.genesysgo.net
Edits an existing file
Request content type: multipart/form-data
Parameters (FormData fields)
Request Body
Name | Type | Description |
---|---|---|
file* | String | The file you want to upload. You may add up to 5 files each with a field name of
. |
message* | String | Base58 message signature. |
signer* | String | Publickey of the signer of the message signature and owner of the storage account |
storage_account* | String | Key of the storage account you want to upload to |
url* | String | Url of the original file you want to edit. Example:
|
list-objects
POST
https://shadow-storage.genesysgo.net
Get a list of all files associated with a storage account
Request content type: application/json
Request Body
Name | Type | Description |
---|---|---|
storageAccount | String | String version of the storage account PublicKey that you want to get a list of files for |
list-objects-and-sizes
POST
https://shadow-storage.genesysgo.net
Get a list of all files and their size associated with a storage account
Request content type: application/json
Request Body
Name | Type | Description |
---|---|---|
storageAccount* | String | String version of the storage account PublicKey that you want to get a list of files for |
get-object-data
POST
https://shadow-storage.genesysgo.net
Get information about an object
Request content type: application/json
Request Body
Name | Type | Description |
---|---|---|
location* | String | URL of the file you want to get information for |
delete-file
POST
https://shadow-storage.genesysgo.net
Deletes a file from a given Storage Account
Request content type: application/json
Request Body
Name | Type | Description |
---|---|---|
message | String | Base58 message signature. |
signer | String | Publickey of the signer of the message signature and owner of the storage account |
location | String | URL of the file you want to delete |
add-storage
POST
https://shadow-storage.genesysgo.net
Adds storage
Request content type: application/json
Request Body
Name | Type | Description |
---|---|---|
transaction * | String | Serialized add storage transaction that is partially signed by the ShdwDrive network |
reduce-storage (updated)
POST
https://shadow-storage.genesysgo.net
Reduces storage
Request content type: application/json
Request Body
Name | Type | Description |
---|---|---|
transaction * | String | Serialized reduce storage transaction that is partially signed by the ShdwDrive network |
make-immutable (updated)
POST
https://shadow-storage.genesysgo.net
Makes file immutable
Request content type: application/json
Request Body
Name | Type | Description |
---|---|---|
transaction | String | Serialized make immutable transaction that is partially signed by the ShdwDrive network |
Example - Secure Sign and Upload File to ShdwDrive using API
This example demonstrates how to securely upload files to the ShdwDrive using the provided API. It includes the process of hashing file names, creating a signed message, and sending the files along with the necessary information to the ShdwDrive endpoint.
Example - Editing a File in ShdwDrive using API and Message Signature Verification
In this example, we demonstrate how to edit a file in ShdwDrive using the API and message signature verification. The code imports necessary libraries, constructs a message to be signed, encodes and signs the message, and sends an API request to edit the file on ShdwDrive.
Example - Deleting a File from ShdwDrive using Signed Message and API
In this example, we demonstrate how to delete a file from the ShdwDrive using a signed message and the ShdwDrive API. The code first constructs a message containing the storage account and the file URL to be deleted. It then encodes and signs the message using the tweetnacl library. The signed message is then converted to a bs58-encoded string. Finally, a POST request is sent to the ShdwDrive API endpoint to delete the file.
Last updated