Storage API

Storage API PRODUCT     AVGIDEA, INC. 

Avgidea Storage に対して API 経由でファイルの操作(アップロードやダウンロードなど)を実行できます


共通パラメータ

% curl -X POST -H 'content-type: application/json' -d '{"accesskey":"<accesskey>", "secret":"<secretkey>", "component":"storage", "action":"<action>" ... }' https://<endpoint url>

パラメータ


ファイルのアップロード

ファイルのアップロードには、下記の2つのステップを実行が必要です。

1. アップロード用のリファレンスを生成

% curl -X POST -H 'content-type: application/json' -d '{"accesskey":"<accesskey>", "secret":"<secretkey>", "component":"storage", "action":"putref", "datasource":"ds1", "object":"data.csv"}' https://<endpoint url>

{"data":"https://<upload url>","status":"success"}

パラメータ

戻り値


2. ローカル環境上のファイルをアップロード

% curl -X PUT --upload-file ./data.csv https://<upload url>

パラメータ


ファイルのダウンロード

ファイルのダウンロードには、下記の2つのステップを実行が必要です。

1. ダウンロード用のリファレンスを生成

% curl -X POST -H 'content-type: application/json' -d '{"accesskey":"<accesskey>", "secret":"<secretkey>", "component":"storage", "action":"getref", "datasource":"ds1", "object":"data.csv"}' https://<endpoint url>

{"data":"https://<download url>","status":"success"}

パラメータ

戻り値


2. ローカル環境ファイルをダウンロード

% curl -X GET -o ./data.csv https://<download url>

パラメータ


ファイル一覧の取得

% curl -X POST -H 'content-type: application/json' -d '{"accesskey":"<accesskey>", "secret":"<secretkey>", "component":"storage", "action":"list", "datasource":"ds1"}' https://<endpoint url> | jq

{

  "data": [

    {

      "name": "data/file1.txt",

      "registeredAt": "2024-04-24T09:42:29.628Z",

      "size": 20017,

      "updatedAt": "2024-04-24T09:42:29.628Z"

    },

    ...

  ],

  "status": "success"

}

パラメータ

戻り値


ファイルの削除

% curl -X POST -H 'content-type: application/json' -d '{"accesskey":"<accesskey>", "secret":"<secretkey>", "component":"storage", "action":"delete", "datasource":"ds1", "object":"file1.txt"}' https://<endpoint url>


パラメータ

戻り値