Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

Children Display
pageSuperb Cloud API

FlexCLI is a simple unix shell script that executes Curl requests via the Flex Cloud API. This console app, demonstrates a few possibilities for interaction with the api.


Table of Contents
includeDownload|Commands|Inputs and values|Using.*|Testing.*|An Example Request


Click here to download the zipped file:, save/relocate to an appropriate directory such as  /usr/local/flexTools.

Or find the latest stable release

Using terminal:

  1. Navigate to the directory where you want to store the script folder:
Code Block
$ cd /usr/local

     2. Use wget to download the package,

this example uses v1.1, but will work for newer releases
Code Block
/usr/local$ wget

    3. Extract the files

Code Block
/usr/local$ tar -zxvf v1.1.tar.gz

    4. Now you can execute the script from this directory (or from anywhere using the full path)

Code Block
/usr/local$ cd flexCLI-1.1
/usr/local/flexCLI-1.1$ ./ help


All of the flexCLI commands except "list" correspond to an API call. To learn more about what is required, or what a command does check out it out in the API guide:

CommandDescriptionCorresponding API CallReturns On Success
build <virtual_machine_id>builds specified VMBuild Virtual Server"success"
createcreates a new VMAdd Virtual ServerJSON Virtual Machine Object
delete <virtual_machine_id>deletes VMDelete Virtual Server"success"
edit <virtual_machine_id>edits(also used to re-size) specified VMEdit Virtual ServerJSON Virtual Machine Object
list(ls)A brief formatted summary of all your machinesN/ABrief overview of current machines
list(ls)<virtual_machine_id>A brief formatted summary of a single VMN/ABrief overview of single VM
getreturns a json array representing all your machinesGet List of Virtual MachinesJSON Virtual Machine Object Array
get<virtual_machine_id>returns the json object representation of specified VMGet specific VM DetailsJSON Virtual Machine Object

reboot <virtual_machine_id>

reboot a single VMReboot Virtual Server"success"
search <label>search for a VM by labelSearch Virtual Servers by labelJSON Virtual Machine Object Array
shutdown <virtual_machine_id>shuts down specified VMShutdown Virtual Server"success"
statusreturns a list of all VM statusesGet statuses for All VMs

JSON Virtual Machine Status Object Array

status <virtual_machine_id>returns the status of a single VMGet Specific VS StatusJSON Virtual Machine Status Object
stop <virtual_machine_id>stops specified VMStop Virtual Server"success"
startup <virtual_machine_id>starts specified VMStartup a Virtual Server"success"
testtests api connectionTest Route"success"

Inputs and values

To specify a VM parameter when creating or editing a VM use --<parameter> followed by the value. The flags -u <account_id> -p <password> are required for all requests (unless they are defined in a config file):

Code Block
/usr/local/flexCLI-1.1$ ./ edit <virtual_machine_id> -u <account_id> -p <api_key> --label="newlabel"

You may also place them in a configuration file, included with --config="flexConfig.ini"

Using a config file to store your credentials:

As an alternative to explicitly declaring your credentials with each request you can use config file to store them.

When working with multiple Flex Cloud accounts, you can create separate config files to store each account's information.

Bundled with the FlexCLI source you will find an example config file. Open it with your favorite editor replace these lines with your credentials:

No Format

should now look something like:

No Format

then save and continue.


You can use the hash (#) to create comments.


Testing your authentication/connection

The "test" command can be used to test your connection.

Code Block
/usr/local/flexCLI-1.1$ ./ test --config="flexConfig.ini"

An Example Request

This is an example showing how to edit a VM use --<parameter> followed by the value. Here we are changing the label to "newlabel":

Code Block
/usr/local/flexCLI-1.1$ ./ edit <virtual_machine_id> -u <account_id> -p <api_key> --label="newlabel"


Use "ls" to get a quick overview of your servers and their statuses

Code Block
/usr/local/flexCLI-1.1$ ./ ls --config="flexConfig.ini"
	|   511|          hostOmatic||       500|       31|     running|
	|   561|         emailServer||      1500|        7|    building|
	|   562|          superServe||       384|        6|     running|
	|   576|          serverTron||      1548|        8|     running|
	|   587|          powerServe||       384|        6|     running|
	|   589|            hosteria||       512|        6|    shutdown|


Use -f to format the JSON output, making it more readable from the console. 

Code Block
/usr/local/flexCLI-1.1$ ./ get --config="flexConfig.ini" -f
        "admin_note":"Test Who?",