Entity API
Data can be transferred between Avgidea Storage and external databases or storage. For storage, data is transferred on an object (file) basis. For databases, records in a table can be output as a CSV file or loaded into a table.
The destination database or storage must be registered with ADP as a datasource in advance.
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
% curl -X POST -d "{\"accesskey\":\"<accesskey>\", \"secret\":\"<secretkey>\", \"component\":\"function\", \"action\":\"<action>\" ...}" https://<endpoint url>
Note :
When using curl commands under Windows, use only double quotes and escape within JSON data, as in the example at left.
Copying Objects Between Storages
You can copy specific objects or groups of objects that match a condition from one storage to another.
a. Copying files between storage (single file)
% curl -X POST -d '{"accesskey":"<accesskey>", "secret":"<secretkey>", "component":"entity", "action":"transfer", "from":"as1", "to":"as2", "object":"data.csv"}' https://<endpoint url>
{"data":"Transferred successfully","status":"success"}
Parameters
action : transfer
from : Origin datasource of storage
to : Destination datasource of storage
object : Object name of origin datasource
Return value
transfer status and message
b. Copying files (multiple files) between storage
% curl -X POST -d '{"accesskey":"<accesskey>", "secret":"<secretkey>", "component":"entity", "action":"transfer", "from":"as1", "to":"as2", "filter":"data"}' https://<endpoint url>
{"data":"Transferred successfully","status":"success"}
Parameters
action : transfer
from : Origin datasource of storage
to : Destination datasource of storage
filter : Copy objects whose object name contains the specified string
Return value
transfer status and message
Loading CSV files from storage to database
CSV files in storage can be loaded directly into database tables.
Loading a CSV file
% curl -X POST -d '{"accesskey":"<accesskey>", "secret":"<secretkey>", "component":"entity", "action":"transfer", "from":"as1", "to":"orcl", "object":"employee.csv", "table":"employees" "worker":4}' https://<endpoint url>
{"data":"Transferred successfully","status":"success"}
パラメータ
action : transfer
from : Origin datasource of storage
to : Destination datasource of database
object : CSV file in storage to be loaded into database
table : Name of table to load
worker : Number of parallels in data loading
Return value
transfer status and message
Exporting CSV files from a database
Tables in a database can be output to storage as CSV files.
Extracting a CSV file
% curl -X POST -d '{"accesskey":"<accesskey>", "secret":"<secretkey>", "component":"entity", "action":"transfer", "from":"orcl", "to":"as1", "table":"employees", "table":"employees"}' https://<endpoint url>
{"data":"Transferred successfully","status":"success"}
Parameters
action : transfer
from : Datasource name of database
to : Datasource name of storage
table : Table name to extract
Return value
transfer status and message