Storage account management

Storage account keys are required to be saved to the user's account in order for the user to read/write data from/to external storage locations.

1010data currently supports Amazon S3 and Azure Blob Storage.

The following functions manage storage account keys: addkey, listkeys, putkey, readkeys, and rmkey. Each function, except for listkeys and readkeys, requires <key> input.

Query string

The query string in the HTTP header must contain the following parameters:

api
Specify the name of the API transaction.
apiversion
Specify the version of the API that should handle the requested transaction.

For the most up-to-date version, use apiversion=3.

uid
Specify a valid 1010data user name.
pswd
Specify a valid password for the 1010data user name provided to the uid parameter.
Note: The pswd value should be the encrypted password returned from the login transaction.
sid
The session ID for the current API session.

This value is returned by the login transaction and must be provided to every transaction (except login).

kill (optional)
Valid values for kill are as follows:
yes
Terminate the existing session and start a new one.
no
Do not terminate the existing session.

If no session exists, a new one will be created. If a session does exist, an error is returned.

Note: If kill=no and a session is active, the system returns an error.
possess
Log in and possess the existing session.
auth
Authenticate with the system but do not kill, possess, or start any session.

The default is yes.

XML input to server

addkey
Add a storage account key so that the user can read/write data from/to external storage.
Both Amazon and S3 require <key> input, including the following:
name
The user-defined name of the key.
type
The type of key, either S3 (Amazon S3) or abs (Azure Blob Storage).
Within <key>, required input for Amazon S3:
<AWS_ACCESS_KEY_ID>
The 20-character key ID.
<AWS_SECRET_ACCESS_KEY>
The 40-character secret key.
<AWS_DEFAULT_REGION>
The region where the s3 bucket resides.

Within <key>, required input for Azure Blob Storage:

<AZURE_STORAGE_ACCOUNT_KEY>
The Azure storage account key from the Azure portal.
listkeys
Returns a list of key names associated with the user account.

There is no required input for listkeys.

putkey
Modify the external storage account key.

Both Amazon and S3 require <key> input, including the following:

name
The user-defined name of the key.
type
The type of key, either S3 (Amazon S3) or abs (Azure Blob Storage).
Within <key>, required input for Amazon S3:
<AWS_ACCESS_KEY_ID>
The 20-character key ID.
<AWS_SECRET_ACCESS_KEY>
The 40-character secret key.
<AWS_DEFAULT_REGION>
The region where the s3 bucket resides.

Within <key>, required input for Azure Blob Storage:

<AZURE_STORAGE_ACCOUNT_KEY>
The Azure storage account key from the Azure portal.
readkeys
Returns all of the keys saved in the user's account, including the key information.

There is no required input for readkeys.

rmkey
Remove a storage key account by name.
Both Amazon and S3 require the following <key> input:
name
The user-defined name of the key.

XML response from server

A successful response from the server contains the following elements:

<rc>
The return code generated by the transaction. For a list of return codes, see Return codes.
<msg>
The message returned by the system. Specific messages correspond to specific return codes.
<keys> (listkeys and readkeys only)
Contains a <key> element for each key associated with the user.

Query string example

https://www2.1010data.com/gw.k?api=addkey&apiversion=3&uid=$UID&pswd=$PSWD&sid=$SID

XML input example for addkey/putkey

#Add azure storage account key via api=addkey
<in>
  <key name="my_key" type="abs">
    <AZURE_STORAGE_ACCOUNT_KEY>xxxxxxxxxxxx</AZURE_STORAGE_ACCOUNT_KEY>
  </key>
</in>

#Add s3 storage account key via api=addkey
<in>
  <key name="my_key" type="s3">
    <AWS_ACCESS_KEY_ID>the 20 character id</AWS_ACCESS_KEY_ID>
    <AWS_SECRET_ACCESS_KEY>the 40 character secret</AWS_SECRET_ACCESS_KEY>
    <AWS_DEFAULT_REGION>region where the s3 bucket resides</AWS_DEFAULT_REGION>
  </key>
</in>

XML input example for rmkey

<in>
  <key name="my_azure_key"/>
</in>

XML response examples

addkey:
<out>
  <rc>0</rc>
  <msg>key my_key added successfully</msg>
</out>
listkeys:
<out>
  <rc>0</rc>
  <msg>listkeys successful</msg>
  <keys><key name="my_s3_key" type="s3"></key></keys>
</out>
putkey:
<out>
  <rc>0</rc>
  <msg>key my_key updated successfully</msg>
</out>
readkeys:
<out>
  <rc>0</rc>
  <msg>getkeys successful</msg>
  <keys>
    <key name="my_s3_key" type="s3"><aws_access_key_id>xxxxxxxxxxxxxxxxxxxx</aws_access_key_id>
      <aws_secret_access_key>yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy</aws_secret_access_key>
      <aws_default_region>us-east-1</aws_default_region>
    </key>
  </keys>
</out>
rmkey:
<out>
  <rc>0</rc><msg>key my_key removed successfully</msg>
</out>