N7 Storage
N7 Storage provides an on-demand API to upload files, allowing seamless access to those resources via your registered domain.
Prerequisite#
- You must have an active account on Nitrogen.
- Your target domain, where files will be uploaded and accessed, must be registered on Nitrogen.
- A service account with Editor access must be configured. If you don’t have one, refer to this article to create API keys.
API: Upload Files to N7 Storage#
API :
POST https://storvia.n7.io/upload/{domain}/{resource_path}Request Headers :
Authorization: Token <api-key-of-service-account>If using PostMan, set the
Auth TypetoNo Auth. And then set theAuthorizationheader inHeaderssection.Request Body :
- Use a multipart/form-data form with the file to upload.
form 'file=@"{file_path}"'
Explanation of Upload API Parameters#
- Path params :
domain: The domain where the file should be uploaded.resource_path: The desired resource path (e.g., images/photo.jpg) for accessing the file later.
- Form Data :
form: The path to the local file being uploaded.
Example: Upload API Request#
curl --request POST --location 'https://storvia.n7.io/upload/{domain}/image.jpg' \
--header 'Authorization: Token <api-key-of-service-account>' \
--header 'Content-Type: application/json' \
--form 'file=@"/C:/Users/n7/Downloads/image.jpg"'If using PostMan, set the
Auth TypetoNo Auth. And then set theAuthorizationheader inHeaderssection.
API Response#
Example: Upload API Response#
{
"key":"{domain}/xx/xx/xxxxxxxxxxxxxxxxxxxxxxxxxxx",
"path":"image.jpg"
}Upload API Response Explanation#
Here,
key: The full storage path of the uploaded file in N7 Storage. This is used internally to locate the file.path: The resource path that can be used to access the file via your domain.
CLI: Upload Bulk Files to N7 Storage#
Download Links :
How to Upload Files :
Open your terminal and navigate to the directory where the CLI tool was downloaded.
Run the appropriate command below to upload your files:
- macOS & Linux
./storvia-cli sync -d <your-domain> <folder-path>- Windows
./storvia-cli.exe sync -d <your-domain> <folder-path>- When prompted, provide the service token for your domain. (This is required the first time you use the CLI tool.)
CLI Command Reference#
- Commands :
sync: Uploads files from the specified directory
- Flags :
-d <domain>: Specifies the target domain for file uploads. (Required)--token <service-token>: Your domain’s service token. (Optional if already stored)