The VergeIO system offers an API interface for custom development integration. This document serves to outline use of the API. Detailed information for the API can be found within the VergeIO UI, as a Swagger wiki page; the wiki page is created dynamically and will show a complete listing of VergeIO tables to access.
Customers can access the inline Swagger documentation by navigating following these steps:
Login in to any VergeIO system with valid user credentials
From the Main Dashboard, click System on the left menu.
Once inside the System Dashboard, at the bottom left, there is a link to the API documentation.
Click the link to launch the Swagger documentation wiki (Note: The page may take a couple minutes to load.) The swagger page provides examples of each function, a list of operations for each, and an ability to test each.
Click an individual table in the line to access options:
Click one of the GET/POST/DELETE/PUT options:
Specify parameters and click the Execute Button to run the API Command
This will return the response which includes the response body and header. Included is a curl example to be used in your program.
The following are ways to pass authentication through the API. Currently, VergeIO offers two methods:
For the basic http authentication, the API is only available through SSL.
For API Database table, this is done by
To get a login token, developers will need to post to the /sys/tokens table for the customer system. As an example, the API URL for a test tenant would be https://systemname.systemdomain.com/api/sys/tokens . Here is an example curl:
curl --header "X-JSON-Non-Compact: 1" --basic --data-ascii '{"login": "USERNAME", "password": "PASSWORD"}' --insecure --request "POST" --header 'Content-Type: application/json' 'https://test.cloud.Verge.io.com/api/sys/tokens’
Here is an example of what would be returned:
{
"location":"\/sys\/tokens\/3a334563456378845634563b7b82d2efcadce9",
"dbpath":"tokens\/3a334563456378845634563b7b82d2efcadce9",
"$row":1,
"$key":"3a334563456378845634563b7b82d2efcadce9"
}
Developers would now need to pass the value in "$key" in the HTTP header "x-yottabyte-token". So in this example a developer would send the following header:
x-yottabyte-token: 3a334563456378845634563b7b82d2efcadce9
To issue a logout for this token/session, the API will need to send a DELETE HTTP Method to /sys/tokens/3a334563456378845634563b7b82d2efcadce9
Optionally, when sending API requests, developers can pass the header "X-JSON-Non-Compact: 1" to have all responses sent back as friendly-spaced JSON.
Developers can request a copy of the "yb-api" script which is a helper used to make API calls. For help and a list of options developers can run "yb-api --help". To run this, connect to a node in your cluster, either directly or through SSH. Then type in the commands there.
Notes regarding yb-api helper script:
The helper "yb-api" script uses wget, which may not automatically be installed on OSX.
The helper "yb-api" script also uses curl on an upload function.
The following are example commands using yb-api:
Get a list of VMs (the filter will make this query exclude VM snapshots):
yb-api --get --user=admin --server=10.0.0.100 --fields='name,$key,ram,machine#status#status as machine_status' --filter='is_snapshot eq false' /v4/vms
Get a list of VMs Simple Dump (--server, --user, --filter, --fields are optional):
yb-api --get /v4/vms
Get most of the fields, including drives and nics, for VM 1 (this number would be the value of $key that is returned in the above query):
yb-api --get --user=admin --server=10.0.0.100 --fields='most,machine[most,drives[most],nics[most]]' /v4/vms/1
Change the name of VM 1:
yb-api --put='{"name":"NEWNAME"}' --user=admin --server=10.0.0.100 /v4/vms/1
Delete VM 1:
yb-api --delete --user=admin --server=10.0.0.100 --fields='name,$key,ram' /v4/vms/1
Create a new VM:
yb-api --post='{"name":"NEWVM","enabled":true,"description":"test vm","os_family":"linux","cpu_cores":4,"ram":"8192"}' --user=admin --server=10.0.0.100 /v4/vms
Get the VMs database table schema:
yb-api --get --user=admin --server=10.0.0.100 '/v4/vms/$table'
Clone VM 1:
yb-api --get --user=admin --server=10.0.0.100 '/v4/vm_actions' --post='{"vm":1, "action": "clone", "params": {"name": "NEW VM NAME"}}'
Power on VM 1:
yb-api --get --user=admin --server=10.0.0.100 '/v4/vm_actions' --post='{"vm":1, "action": "poweron"}'
Overview
The yCenter API is RESTlike. All API requests must be made over HTTPS and should be authenticated with Basic Access Authentication. It is also possible to POST to /api/sys/tokens to create a session and pass that as the header "x-yottabyte-token" which needs to be deleted to log out.
Resources
Below is an example URL used to query a list of machines.
Example: https://user1:xxxxxx@server1.verge.io/api/v4/machines?fields=all
https:// | user | : | password | @ | server | /api | /v4/machines | ? | filter=&fields=all&sort=&limit= |
User name | User Password | Server host name or IP | Resource location (URI) | These options are described below |
GET Options
Fields
Filter
Operator | Description |
eq | Equal |
ne | Not equal |
gt | Greater than |
ge | Greater than or equal |
lt | Less than |
le | Less than or equal |
bw | Begins with |
ew | Ends with |
and | Logical and |
or | Logical or |
cs | Contains string (case sensitive) |
ct | Contains text (case insensitive) |
rx | Regex match |
Sort
Limit
Generic HTTP Response Codes
Post Specific
Websocket Specific (Used for VNC/SPICE)
PUT/GET/DELETE
Schema Owner / Parent Field
To retrieve a table’s schema append $table to the URI:
/api/v4/machines/$table (replace machines with the table name)
It will ask for your credentials, this does not support your other authentication methods and requires your VergeIO admin credentials.
Note: The output is in JSON format. Firefox will display this by default in a nice readable format. For other browsers you may want to output to another program to view the JSON correctly.
{
"err": "Validation error on field: 'dhcp_start' - 'fails validation test'"
}
Need more Help? Email support@verge.io or call us at (855) 855-8300