Storage API
File operations (upload, download, etc.) can be performed on Avgidea Storage via the API.
Common parameters
% curl -X POST -H 'content-type: application/json' -d '{"accesskey":"<accesskey>", "secret":"secretkey", "component":"storage", "action":"<action>" ... }' https://<endpoint url>
Parameters
accesskey : Access key
secet:Secret key
component : storage
action : action to execute
endpoint url : URL to send API requests
Uploading an object
Uploading a file requires the following two steps
Generate a reference for upload
Upload the file on the local environment
1. Generate references for upload
% curl -X POST -H 'content-type: application/json' -d '{"accesskey":"<accesskey>", "secret":"secretkey", "component":"storage", "action":"putref", "datasource":"ds1", "obj":"data.csv"}' https://<endpoint url>
{"data":"https://<upload url>","status":"success"}
Parameters
action : putref
datasource : Data source name for Avgidea Storage
obj : name of object to upload
Return value
data : URL to upload the object
2. upload a file on the local environment
% curl -X PUT --upload-file . /data.csv https://<upload url>
Parameters
upload-file : Name of the file in the local environment
upload url : URL to upload the object
Downloading an object
To download the file, the following two steps must be performed
Generate a reference for download
Download the file to your local environment
1. Generate references for download
% curl -X POST -H 'content-type: application/json' -d '{"accesskey":"<accesskey>", "secret":"secretkey", "component":"storage", "action":"getref", "datasource":"ds1", "obj":"data.csv"}' https://<endpoint url>
{"data":"https://<download url>","status":"success"}
Parameters
action : getref
datasource : Name of the Avgidea Storage data source
obj : name of object to download
Return value
data : URL from which the object was downloaded
2. Download the file to your local environment
% curl -X GET -o ./data.csv https://<download url>
Parameters
download url : URL from which to download the object