Storage CLI Client for Microsoft Windows

The Storage API Command line interface (CLI) client for Microsoft Windows is a simple implementation of Storage API, currently supporting only a very limited set of the API features: loading data into Storage. In case you need more data manipulation features, check out the PHP CLI client.

The client source code is available in our Github repository.

Installation

This application requires .NET Framework 4.0 (or higher) which is natively included since Windows 7 and Windows Server 2008 R2. A download is available for older versions of Windows.

Manual Installation

If you do not want to install Chocolatey, simply download all the application files in a ZIP package.

Installation via Chocolatey

Chocolatey is a package manager for Windows and can be used for installing the Storage API client package.

If you do not have Chocolatey installed, do so using the following (administrator) command line:

@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin

Chocolatey will be installed, by default, into C:\ProgramData\chocolatey. Once done, make sure to open a new instance of the command line window.

To install the SAPI client, just run the following command in the windows command line:

cinst SapiClient

This command will install all SAPI client application binaries into C:\ProgramData\chocolatey\bin\.

Uninstalling the Client

You can uninstall the SAPI client from Chocolatey by typing the following command:

cuninst SapiClient

All the Storage API Client application binaries and folders will be deleted (Chocolatey itself remains installed).

Running the Client

Now run the sapi-client command globally from any folder in the windows command line. By running

sapi-client

you can see all available commands of the client.

Example — Creating a Table

To create a new table in Storage, use the create-table command. Provide the name of an existing bucket, the name of the new table and a CSV file with the table’s contents.

To create the new-table table in the in.c-main bucket, use

sapi-client create-table in.c-main new-table D:\new-table.csv --token=storage_token --primary-key=id

The above command will import the contents of new-table.csv into the newly created table. It will also mark the id column as the primary key.

Example — Importing Data

If you want only to import new data into the table, use the write-table command. Provide the ID (bucketName.tableName) of an existing table.

To import data into the new-table table in the in.c-main bucket, use

sapi-client write-table in.c-main.new-table D:\new-data.csv --token=storage_token --incremental

The above command will import the contents of the new-data.csv file into the existing table. If the --incremental parameter is supplied, the table contents will be appended. If the parameter is not supplied, the table contents will be overwritten.