Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 27 Next »

Table of contents

Introduction

By sending requests to the Virtual Machine endpoint https://vss-api.eis.utoronto.ca:8001/v2/vm/ you can list, create, update or delete VMs. The Virtual Machine endpoint has the following methods available:

ResourceURIDescriptionGETPOSTPUTDELETEOPTIONS*
Virtual Machine/vm/Virtual Machine management resource. Read, update, delete, create virtual machines.(tick)(tick)(tick)(tick)(tick)

OPTIONS HTTP method

Remember, you can also show what methods are allowed and method description, parameters, etc. by making a GET HTTP request to https://vss-api.eis.utoronto.ca:8001/v2/vm/.

http OPTIONS "https://vss-api.eis.utoronto.ca:8001/v2/vm/"
curl -X OPTIONS "https://vss-api.eis.utoronto.ca:8001/v2/vm/" 

Create

Single Virtual Machine

To create a new Virtual Machine, send a POST request to /v2/vm/. The attribute values that must be set to successfully create a Virtual Machine are marked with a (tick) in the following table:

AttributeDescriptionTypeRef URIOptionsDefaultRequired
admin_emailAdministrator's emailstring--User's email number submitting the request 
admin_nameAdministrator's namestring--User's name number submitting the request 
admin_phoneAdministrator's phone numberstring--User's phone number submitting the request 
bill_deptBilling Departmentstring---(tick)
built_from

Build process. If you are installing OS from scratch use os_install.

Clone when deploying a VM from a running or powered off virtual Machine.

Template gives the ability to deploy multiple VMs at the same time.

string-

os_install

clone

template

-(tick)
cpuCPU countinteger--1 
descriptionShort description of the service or application. This will be part of the annotations field.string---(tick)
disksDisks in GigaBytes.array--

[40]

 
high_io

If set to true,VM will be created with a VMware Paravirtual SCSIController.

PVSCSI controllers are best suited for environments, especially SAN environments, running I/O-intensive applications.

boolean-

True

False

False 
domainFault domain moId (Managed Object Identifier)string/v2/domain/-Fualt Domain 3 
folderFolder moId (Managed Object Identifier)string/v2/folder/--(tick)
informInformational comma separated emailsstring--User's email number submitting the request 
isoISO image path to be mounted after creationstring/v2/isos/-None 
memoryMemory in GBinteger--1 
nameHuman readable name without the VSS Prefix. This prefix will be added before creation.string--Randomly generated 
networks

Network Managed Object Identifier (moId) array.

Each network will be attached to a Network Adapter VMXNET3, the most recent virtual network device from VMware, and was designed from scratch for high performance and to support new features.

array--Unaccessible VLAN 
os

Supported guest operating system identifier.

string/v2/os/--(tick)
usageVirtual Machine usage. Prod for Production, Test for testing, QA for Quality Assurance, and Dev for Development.string-

Prod

Test

QA

Dev

Test 
source_vmSource Virtual Machine Uuid.string

/v2/vm/

 

--

(tick) only with clone

source_templateSource Virtual Machine Template Uuid.string/v2/template/--(tick) only with template

A new virtual machine can be created with as few as the following attributes in JSON format:

Request Body
{"usage": "Prod",
 "os": "ubuntu64Guest",
 "built_from": "os_install",
 "bill_dept": "EIS",
 "description": "Java web application.",
 "folder": "group-v4122",
 "networks": ["dvportgroup-95",
              "dvportgroup-92"],
 "disks": [40, 100]
}

HTTPie

http -a $TK POST "https://vss-api.eis.utoronto.ca:8001/v2/vm/" usage='Prod' os='ubuntu64Guest' built_from='os_install' bill_dept='EIS' description='Java web application.' folder='group-v4122' networks:='["dvportgroup-95", "dvportgroup-92"]' disks:='[40, 20]'

CURL

curl -u $TK -X POST "https://vss-api.eis.utoronto.ca:8001/v2/vm/" -d '{"usage": "Prod", "os": "ubuntu64Guest", "built_from": "os_install", "bill_dept": "EIS", "description": "Java web application.", "folder": "group-v4122", "networks": ["dvportgroup-95", "dvportgroup-92"], "disks": [40, 100]}'

If the request was successfully submitted and all parameters were accepted, the following Response Status, Headers and body will be received:

Response Headers
HTTP/1.0 202 ACCEPTED
Allow: HEAD, POST, OPTIONS, GET
Content-Length: 364
Content-Type: application/json
Date: Tue, 26 Apr 2016 18:24:23 GMT
Location: https://vss-api.eis.utoronto.ca:8001/v2/request/task/fa276e28-a876-477a-ab40-0d2d84df9234
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7190
X-RateLimit-Reset: 1461697200
Response Body
{
    "data": {
        "_links": {
            "request": "https://vss-api.eis.utoronto.ca:8001/v2/request/new/8", 
            "task": "https://vss-api.eis.utoronto.ca:8001/v2/request/task/fa276e28-a876-477a-ab40-0d2d84df9234"
        }, 
        "message": "New VM Request has been accepted for processing", 
        "name": "Accepted", 
        "status": 202
    }, 
    "meta": {
        "time": "0.08575s", 
        "user": "jm"
    }
}

Note that you will receive as well additional Hypermedia links contained in the _links attribute. Request object is the new virtual machine creation request which stores all parameters previously submitted and Task, is the unique task in charged of processing your request. Request and Task are both related, in terms of status, errors and warnings. Request will store any status or errors caught by the task, also it will pass the recently created VM Uuid.

Task

Request processing is almost instantaneous, however you could check the task progress by making a HTTP GET request to any given /v2/request/task/<task_id> endpoint.

Response Body
 {
    "_links": {
        "request": "https://vss-api.eis.utoronto.ca:8001/v2/request/", 
        "self": "https://vss-api.eis.utoronto.ca:8001/v2/request/task/a57a3d4a-9e94-4822-a1d3-f99db1005dbd"
    }, 
    "data": {
        "result": {
            "current": 100, 
            "result": {
                "errors": [], 
                "warnings": [
                    "Fault Domain: FD3 ", 
                    "Created in: VSS > Sandbox > jm", 
                    "Network adapter 1: 00:50:56:92:50:6d: VL-1102-UTCS", 
                    "Network adapter 2: 00:50:56:92:3f:91: VL-1072-VSGAN"
                ]
            }, 
            "status": "1604P-desperate_thompson Processed", 
            "total": 100
        }, 
        "status": "SUCCESS"
    }, 
    "meta": {
        "count": 2, 
        "time": "0.00028s", 
        "user": "jm"
    }
}

Request 

Checking the overall status of the request and also the resulting Uuid can be done by making a HTTP GET request to /v2/request/new/8 endpoint:

Response Body
{
    "_link": {
        "request": "https://vss-api.eis.utoronto.ca:8001/v2/request/new/", 
        "self": "https://vss-api.eis.utoronto.ca:8001/v2/request/new/8"
    }, 
    "data": {
        "_links": {
            "task": "https://vss-api.eis.utoronto.ca:8001/v2/request/task/fa276e28-a876-477a-ab40-0d2d84df9234", 
            "vm": "https://vss-api.eis.utoronto.ca:8001/v2/vm/50122032-96b8-ac69-f584-89c43aee7fef/"
        }, 
        "annotation": [
            "VM Name: 1604P-cranky_euclid", 
            "UTvssAdmin: JM Lopez Lujan:123-123-1234:jm.lopez@utoronto.ca", 
            "UTvssClient: EIS", 
            "UTvssPurpose: Prod", 
            "UTvssRequested: 2016-04-26 14:24:22 ", 
            "UTvssInform: jm.lopez@utoronto.ca", 
            "Description: Java web application.", 
            ""
        ], 
        "built_from": "os_install", 
        "cpu": "1", 
        "created_on": "2016-04-26 14:24:22 EDT", 
        "disks": [
            40, 
            20
        ], 
        "domain": "domain-c5877", 
        "dvd_cd": "", 
        "folder": "group-v4122", 
        "guest_os": "ubuntu64Guest", 
        "high_io": false, 
        "id": 8, 
        "memory": "1", 
        "message": {
            "errors": [], 
            "warnings": [
                "Fault Domain: FD3 ", 
                "Created in: VSS > Sandbox > jm", 
                "Network adapter 1: 00:50:56:92:58:56: VL-1102-UTCS", 
                "Network adapter 2: 00:50:56:92:65:2b: VL-1072-VSGAN"
            ]
        }, 
        "networks": [
            "dvportgroup-95", 
            "dvportgroup-92"
        ], 
        "source_template": null, 
        "source_vm": null, 
        "status": "Processed", 
        "task_id": "fa276e28-a876-477a-ab40-0d2d84df9234", 
        "updated_on": "2016-04-26 14:27:29 EDT", 
        "user": {
            "_links": {
                "self": "https://vss-api.eis.utoronto.ca:8001/v2/user/"
            }, 
            "id": 1, 
            "username": "jm"
        }, 
        "vm_name": "1604P-cranky_euclid", 
        "vm_uuid": "50122032-96b8-ac69-f584-89c43aee7fef"
    }, 
    "meta": {
        "count": 23, 
        "time": "0.00563s", 
        "user": "jm"
    }
}

Multiple Virtual Machines

To create multiple Virtual Machines, send a POST request to /v2/vm/. Creating multiple VMs is quite similar to creating a single VM, but instead of sending name as a string, send names as an array and select the right built process, either clone or template. The following request body is used to deploy three VM from a VM template:

Request Body
{"bill_dept": "EIS",
 "built_from": "template",
 "description": "Ubuntu cluster",
 "os": "ubuntu64Guest",
 "folder": "group-v4122",
 "source_template": "50123c4c-c810-5c0f-6203-eac67f0cb7e8",
 "names": ["Ubuntu1", 
           "Ubuntu2", 
           "Ubuntu3"],
 "networks": ["dvportgroup-95",
              "dvportgroup-92"],
 "disks": [40, 100]}

The main difference between selecting clone or template as built process is that a source VM Template can deploy multiple instances concurrently, whereas a VM Clone can only be deployed concurrently when the source Virtual Machine is powered off. If VM is powered On, it can only be cloned one at a time.

HTTPie

http -a $TK POST "https://vss-api.eis.utoronto.ca:8001/v2/vm/" os='ubuntu64Guest' built_from='template' bill_dept='EIS' description='Ubuntu cluster' folder='group-v4122' networks:='["dvportgroup-95", "dvportgroup-92"]' disks:='[40, 100]' names:='["Ubuntu1", "Ubuntu2", "Ubuntu3"]' source_template=50123c4c-c810-5c0f-6203-eac67f0cb7e8

CURL

curl -u $TK -X POST "https://vss-api.eis.utoronto.ca:8001/v2/vm/" -d '{"bill_dept": "EIS", "built_from": "template", "description": "Ubuntu cluster", "os": "ubuntu64Guest", "folder": "group-v4122", "source_template": "50123c4c-c810-5c0f-6203-eac67f0cb7e8", "names": ["Ubuntu1", "Ubuntu2", "Ubuntu3"], "networks": ["dvportgroup-95", "dvportgroup-92"], "disks": [40, 100]}'
If the request was successfully submitted and all parameters were accepted, the following Response StatusHeaders and body will be received:
Response Headers
HTTP/1.0 202 ACCEPTED
Allow: HEAD, POST, OPTIONS, GET
Content-Length: 682
Content-Type: application/json
Date: Wed, 27 Apr 2016 14:16:42 GMT
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7191
X-RateLimit-Reset: 1461769200
Response Body
{
    "data": {
        "_links": {
            "requests": [
                "https://vss-api.eis.utoronto.ca:8001/v2/request/new/26", 
                "https://vss-api.eis.utoronto.ca:8001/v2/request/new/27", 
                "https://vss-api.eis.utoronto.ca:8001/v2/request/new/28"
            ], 
            "tasks": [
                "https://vss-api.eis.utoronto.ca:8001/v2/request/task/aa1cc5fa-94fc-473f-b29c-47f022745eb2", 
                "https://vss-api.eis.utoronto.ca:8001/v2/request/task/97d1f968-dec5-4249-b23c-226b46258483", 
                "https://vss-api.eis.utoronto.ca:8001/v2/request/task/0ec62b83-6c7f-47ae-8670-588449c3a2cb"
            ]
        }, 
        "message": "New VM Requests have been accepted for processing", 
        "name": "Accepted", 
        "status": 202
    }, 
    "meta": {
        "time": "0.10215s", 
        "user": "jm"
    }
}

The main difference between single and multiple vm creation/deployment is the number of requests and tasks returned by the API. In this case, since we required three VMs, we get the same number of requests and tasks as a result of the POST request, which can be queried individually to verify its progress or result.

Task

Request processing is almost instantaneous, however you could check the task progress by making a HTTP GET request to any given /v2/request/task/<task_id> endpoint.

Response Body
 {
    "_links": {
        "request": "https://vss-api.eis.utoronto.ca:8001/v2/request/", 
        "self": "https://vss-api.eis.utoronto.ca:8001/v2/request/task/aa1cc5fa-94fc-473f-b29c-47f022745eb2"
    }, 
    "data": {
        "result": {
            "current": 100, 
            "result": {
                "errors": [], 
                "warnings": [
                    "Hard disk 1 capacity is the same. No change need to be done.", 
                    "Fault Domain: FD3 ", 
                    "Created in: VSS > Sandbox > jm", 
                    "Network adapter 1: 00:50:56:92:08:08: VL-1102-UTCS", 
                    "Network adapter 2: 00:50:56:92:14:fe: VL-1072-VSGAN"
                ]
            }, 
            "status": "1604T-Ubuntu1 Processed", 
            "total": 100
        }, 
        "status": "SUCCESS"
    }, 
    "meta": {
        "count": 2, 
        "time": "0.00597s", 
        "user": "jm"
    }
}

Requests

Checking the overall status of the requests and also the resulting Uuid can be done by making a HTTP GET request to /v2/request/new/26 - 28 endpoint:

Response Body
{
    "_link": {
        "request": "https://vss-api.eis.utoronto.ca:8001/v2/request/new/", 
        "self": "https://vss-api.eis.utoronto.ca:8001/v2/request/new/26"
    }, 
    "data": {
        "_links": {
            "task": "https://vss-api.eis.utoronto.ca:8001/v2/request/task/aa1cc5fa-94fc-473f-b29c-47f022745eb2", 
            "vm": "https://vss-api.eis.utoronto.ca:8001/v2/vm/5012826a-6a1a-815a-249d-7d6eb640f020/"
        }, 
        "annotation": [
            "VM Name: 1604T-Ubuntu1", 
            "UTvssAdmin: JM Lopez Lujan:416-123-1234:jm.lopez@utoronto.ca", 
            "UTvssClient: EIS", 
            "UTvssPurpose: Test", 
            "UTvssRequested: 2016-04-27 10:16:42 ", 
            "UTvssInform: jm.lopez@utoronto.ca", 
            "Description: Ubuntu cluster", 
            ""
        ], 
        "built_from": "template", 
        "cpu": "1", 
        "created_on": "2016-04-27 10:16:42 EDT", 
        "disks": [
            40, 
            100
        ], 
        "domain": "domain-c5877", 
        "dvd_cd": "", 
        "folder": "group-v4122", 
        "guest_os": "ubuntu64Guest", 
        "high_io": false, 
        "id": 26, 
        "memory": "1", 
        "message": {
            "errors": [], 
            "warnings": [
                "Hard disk 1 capacity is the same. No change need to be done.", 
                "Fault Domain: FD3 ", 
                "Created in: VSS > Sandbox > jm", 
                "Network adapter 1: 00:50:56:92:08:08: VL-1102-UTCS", 
                "Network adapter 2: 00:50:56:92:14:fe: VL-1072-VSGAN"
            ]
        }, 
        "networks": [
            "dvportgroup-95", 
            "dvportgroup-92"
        ], 
        "source_template": "50123c4c-c810-5c0f-6203-eac67f0cb7e8", 
        "source_vm": null, 
        "status": "Processed", 
        "task_id": "aa1cc5fa-94fc-473f-b29c-47f022745eb2", 
        "updated_on": "2016-04-27 10:26:00 EDT", 
        "user": {
            "_links": {
                "self": "https://vss-api.eis.utoronto.ca:8001/v2/user/"
            }, 
            "id": 1, 
            "username": "jm"
        }, 
        "vm_name": "1604T-Ubuntu1", 
        "vm_uuid": "5012826a-6a1a-815a-249d-7d6eb640f020"
    }, 
    "meta": {
        "count": 23, 
        "time": "0.00541s", 
        "user": "jm"
    }
}

List

Virtual machines

In order to list all your Virtual Machines you should make a HTTP GET request to the endpoint /vm/, passing of course your access token. You'll get a quick summary of every single virtual machine you have permission to manage in the EIS Virtual Cloud.

NameTypeDescription
uuidstring128-bit UUID of a virtual machine, represented as a hexademical string. This identifier is used by VirtualCenter to uniquely identify all virtual machine instances, including those that may share the same SMBIOS UUID.
namestringVirtual Machine name including VSS prefix.
guestFullNamestringThis is the full name of the guest operating system for the virtual machine. For example: Windows 2000 Professional.
ipAddressstringPrimary IP address assigned to the guest operating system, if known.

memoryMB

integerMemory size of the virtual machine, in megabytes.

cpuCount

integerNumber of processors in the virtual machine. 

overallStatus

stringOverall alarm status on this node.
powerStatestringThe current power state of the virtual machine.
provisionedGBintegerSum of Committed and Uncommitted storage.

The following examples use HTTPie and CURL to request ALL Virtual Machine managed by given user without filters:

http -a $TK GET "https://vss-api.eis.utoronto.ca:8001/v2/vm/"
curl -u $TK -X GET "https://vss-api.eis.utoronto.ca:8001/v2/vm/"

HTTP response data would look something like:

Response
{
    "_links": {
        "api": "https://vss-api.eis.utoronto.ca:8001/v2/", 
        "self": "https://vss-api.eis.utoronto.ca:8001/v2/vm/"
    }, 
    "data": [
        {
            "_links": {
                "self": "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125944-d5e0-248d-0f3c-c499acbeb1ce/"
            }, 
            "cpuCount": 2, 
            "folder": {
                "_links": {
                    "self": "https://vss-api.eis.utoronto.ca:8001/v2/folder/group-v6557"
                }, 
                "moref": "group-v12342", 
                "name": "Swarm", 
                "parent": "Sandbox"
            }, 
            "guestFullName": "Other 3.x Linux (64-bit)", 
            "ipAddress": "128.100.72.1", 
            "memoryMB": 2048, 
            "name": "1604P-docker-node2", 
            "overallStatus": "green", 
            "powerState": "poweredOn", 
            "provisionedGB": 22, 
            "uuid": "50125944-d5e0-248d-0f3c-c499acbeb1ce"
        }
    ], 
    "meta": {
        "count": 22, 
        "time": "1.04441s", 
        "user": "jm"
    }
}

Filters

The main Virtual Machine resource has three main filters to reduce the number of VMs shown in the result or to locate a VM by hostname or ip address.

NameDescription
nameVirtual Machine name string to filter VMs
ipPrimary IP address assigned to the Guest operating system.
dnsHostname of the guest operating system.
summaryDisables VM summary in results.

The following examples show how to implement a GET request with the first three parameters shown below. The result is similar to the previous section.

http -a $TK GET "https://vss-api.eis.utoronto.ca:8001/v2/vm/?name=Test"
http -a $TK GET "https://vss-api.eis.utoronto.ca:8001/v2/vm/?ip=10.2.1.2"
http -a $TK GET "https://vss-api.eis.utoronto.ca:8001/v2/vm/?dns=wiki.eis.utoronto.ca"

If you decide to add summary in the list of parameters, you'll disable the summary provided by the API about any given VM for this particular request. For example:

http -a $TK GET "https://vss-api.eis.utoronto.ca:8001/v2/vm/?name=Test&summary"

HTTP response data would look something like:

HTTP Response
{
    "_links": {
        "api": "https://vss-api.eis.utoronto.ca:8001/v2/", 
        "self": "https://vss-api.eis.utoronto.ca:8001/v2/vm/"
    }, 
    "data": [
        {
            "_links": {
                "self": "https://vss-api.eis.utoronto.ca:8001/v2/vm/5012bd15-c20c-a971-aa68-af1a3cf3d0db/"
            }, 
            "name": "1604Q-VMTest_1", 
            "uuid": "5012bd15-c20c-a971-aa68-af1a3cf3d0db"
        }
    ], 
    "meta": {
        "count": 1, 
        "time": "1.86220s", 
        "user": "jm"
    }
}

From now on, you will need the UUID of any virtual machine, provided by the either the uuid attribute or in the "_links" section, to get further information and eventually to modify its configuration.

Specific virtual machine info

Some of the attributes will have an object value. Such is the case of the guest, hardware, network, config, vss and guest. 

NameTypeDescription
uuidstringVirtualCenter-specific 128-bit UUID of a virtual machine, represented as a hexademical string. This identifier is used by VirtualCenter to uniquely identify all virtual machine instances, including those that may share the same SMBIOS UUID.
namestringVirtual Machine name including VSS prefix.
ConfigVM Configuration
bootdelayintegerDelay in milliseconds before starting the boot sequence. The boot delay specifies a time interval between virtual machine power on or restart and the beginning of the boot sequence.
hotaddCPUbooleanWhether virtual processors can be added while this virtual machine is running.
hotremoveCpubooleanWhether virtual processors can be removed while this virtual machine is running.
hotaddMembooleanWhether memory can be added while this virtual machine is running.
FolderLogical Folder
namestringImmediate folder holding VM
parentstringParent folder holding the VM
pathstringFull path to immediate folder
GuestGuest status and configuration
guestFullNamestringThis is the full name of the guest operating system for the virtual machine. For example: Windows 2000 Professional.
guestIdstringGuest operating system configured on a virtual machine.
hostNamestringHostname of the guest operating system, if known.
ipAddressstringPrimary IP address assigned to the guest operating system, if known.
toolsStatusstringCurrent running status of VMware Tools in the guest operating system, if known.
toolsVersionstringCurrent version status of VMware Tools in the guest operating system, if known.
Hardware 
cpuCountintegerNumber of processors in the virtual machine. 
coresPerSocketintegerNumber of cores used to distribute virtual CPUs among sockets in this virtual machine. If the value is unset it implies to numCoresPerSocket = 1.
memoryMBintegerMemory size of the virtual machine, in megabytes.
numEthernetCardsintegerNumber of virtual network adapters. 
numVirtualDisksintegerNumber of virtual disks attached to the virtual machine. 
devicesstringList of strings holding controllers, cd/dvd, disks and nics configured in the VM
versionstringThe version string for this virtual machine.
StorageStorage summary
provisionedGBinteger

Sum of Committed and Uncommitted storage.

uncommittedGBintegerAdditional storage space, in bytes, potentially used by this virtual machine on all datastores.
committedGBintegerTotal storage space, in bytes, committed to this virtual machine across all datastores.
unsharedGBintegerTotal storage space, in bytes, occupied by the virtual machine across all datastores, that is not shared with any other virtual machine.
StatusRuntime status related attributes
overallStatusstringOverall alarm status on this node.
powerStatestringThe current power state of the virtual machine.
alarmsbooleanWhether the VM has triggered alarms.
bootTimeStringThe timestamp when the virtual machine was most recently powered on.
VSSVSS Management tags
AdminstringAdmin responsible of this VM.
InformstringInformational contacts to be notified.
Requestedstring

The timestamp when the virtual machine was requested.

ClientstringCustom client key-value notes.

 The following example, requests information about a particular VM using its base resource /vm/ and appending the UUID to get the URI /vm/5012bd15-c20c-a971-aa68-af1a3cf3d0db/

 

http -a $TK GET "https://vss-api.eis.utoronto.ca:8001/v2/vm/5012bd15-c20c-a971-aa68-af1a3cf3d0db/"

HTTP response data would look something like:

Response
{
    "_links": {
        ....
    }, 
    "data": {
        "config": {
            "bootDelayMs": 5000, 
            "hotaddCpu": true, 
            "hotaddMem": true, 
            "hotremoveCpu": false
        }, 
        "folder": {
            "name": "jm", 
            "parent": "Sandbox", 
            "path": "Public > Sandbox > jm"
        }, 
        "guest": {
            "guestFullName": "Ubuntu Linux (64-bit)", 
            "guestId": "ubuntu64Guest", 
            "hostName": null, 
            "ipAddress": null, 
            "toolsStatus": "guestToolsNotInstalled", 
            "toolsVersion": null
        }, 
        "hardware": {
            "coresPerSocket": 1, 
            "cpuCount": 2, 
            "devices": {
                "cds": [], 
                "controllers": [
                    "IDE 0;IDE 0", 
                    "IDE 1;IDE 1", 
                    "SCSI controller 0;LSI Logic"
                ], 
                "disks": [
                    "Hard disk 1;Thin;4GB", 
                    "Hard disk 2;Thin;2GB", 
                    "Hard disk 3;Thin;1GB"
                ], 
                "nics": [
                    "Network adapter 1;Unused_Or_Quarantine_Veth;00:50:56:92:2b:bd", 
                    "Network adapter 2;VL-1102-UTCS;00:50:56:92:11:38"
                ]
            }, 
            "memoryMB": 2048, 
            "numEthernetCards": 2, 
            "numVirtualDisks": 3, 
            "version": "vmx-10"
        }, 
        "name": "1604Q-VMTest_1", 
        "networks": [
            "Unused_Or_Quarantine_Veth", 
            "VL-1102-UTCS"
        ], 
        "snapshot": false, 
        "status": {
            "alarms": false, 
            "bootTime": "", 
            "overallStatus": "green", 
            "powerState": "poweredOff"
        }, 
        "storage": {
            "committedGB": 0, 
            "provisionedGB": 9, 
            "uncommittedGB": 9, 
            "unsharedGB": 0
        }, 
        "uuid": "5012bd15-c20c-a971-aa68-af1a3cf3d0db", 
        "vss": {
            "admin": "JM Lopez:416-123-123:jm@eis.utoronto.ca", 
            "client": "EIS", 
            "inform": "jm@eis.utoronto.ca", 
            "requested": "2016-04-01 10:38:07"
        }
    }, 
    "meta": {
        "count": 11, 
        "time": "0.48864s", 
        "user": "jm"
    }
}
 

Links list have been removed from the VM info section due to its size, however, in the next section we'll describe every single sub resource.

Attributes

CPU

ResourceURIDescriptionGETPOSTPUTDELETEOPTIONS*
Virtual Machine CPU/vm/<vm_uuid>/cpuVirtual Machine CPU resource. Get CPU count, quick stats and update cpu count(tick) (tick) (tick)

CPU info

Requesting cpu info can be as easy as making a GET request to /vm/<vm_uuid>/cpu as shown below:

http -a $TK GET "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cpu"
curl -u $TK -X GET "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cpu"

Respose from the API would look something like:

Response Headers
HTTP/1.0 200 OK
Allow: PUT, HEAD, OPTIONS, GET
Content-Length: 385
Content-Type: application/json
Date: Wed, 27 Apr 2016 17:47:28 GMT
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7179
X-RateLimit-Reset: 1461780000
Response Body
{
    "_links": {
        "self": "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cpu", 
        "vm": "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/"
    }, 
    "data": {
        "cpu": 2, 
        "quickStats": {
            "overallCpuDemandMHz": 71, 
            "overallCpuUsageMHz": 71
        }
    }, 
    "meta": {
        "count": 2, 
        "time": "0.03721s", 
        "user": "jm"
    }
}

CPU update

Increasing or decreasing CPU can be done by making a PUT request to /vm/<vm_uuid>/cpu as shown below:

http -a $TK PUT "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cpu" value=3
curl -u $TK -X PUT "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cpu" -d '{"value": 3}'

Response from the API would look something like:

Response Headers
HTTP/1.0 202 ACCEPTED
Allow: PUT, HEAD, OPTIONS, GET
Content-Length: 397
Content-Type: application/json
Date: Wed, 27 Apr 2016 18:15:08 GMT
Location: https://vss-api.eis.utoronto.ca:8001/v2/request/task/827f4a45-db84-4799-b2f8-a02c85e003be
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7197
X-RateLimit-Reset: 1461783600
Response Body
{
    "data": {
        "_links": {
            "request": "https://vss-api.eis.utoronto.ca:8001/v2/request/change/2", 
            "task": "https://vss-api.eis.utoronto.ca:8001/v2/request/task/827f4a45-db84-4799-b2f8-a02c85e003be"
        }, 
        "message": "VM Change Request has been accepted for processing", 
        "name": "Accepted", 
        "state": "Submitted", 
        "status": 202
    }, 
    "meta": {
        "time": "0.03447s", 
        "user": "jm"
    }
}

Remember you can check task and request status by making a GET request to /v2/request/task/<task_id> and /v2/request/change/<change_id> respectively.

Memory

ResourceURIDescriptionGETPOSTPUTDELETEOPTIONS*
Virtual Machine Memory/vm/<vm_uuid>/memoryVirtual Machine Memory resource. Get Memory count, quick stats and update memory size(tick) (tick) (tick)

Memory info

Requesting memory info can be as easy as making a GET request to /vm/<vm_uuid>/memory as shown below:

http -a $TK GET "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/memory"
curl -u $TK -X GET "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/memory"

Response from the API would look something like:

Response Headers
HTTP/1.0 200 OK
Allow: PUT, HEAD, OPTIONS, GET
Content-Length: 555
Content-Type: application/json
Date: Wed, 27 Apr 2016 18:21:25 GMT
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7193
X-RateLimit-Reset: 1461783600
Response Body
{
    "_links": {
        "self": "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/memory", 
        "vm": "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/"
    }, 
    "data": {
        "memoryMB": 3072, 
        "quickStats": {
            "balloonedMemoryMB": 0, 
            "compressedMemoryKB": 0, 
            "consumedOverheadMemoryMB": 36, 
            "guestMemoryUsageMB": 61, 
            "privateMemoryMB": 2490, 
            "sharedMemoryMB": 124, 
            "swappedMemoryMB": 0
        }
    }, 
    "meta": {
        "count": 2, 
        "time": "0.02911s", 
        "user": "jm"
    }
}

Memory update

Increasing or decreasing CPU can be done by making a PUT request to /vm/<vm_uuid>/memory as shown below:

http -a $TK PUT "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/memory" value=3
curl -u $TK -X PUT "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/memory" -d '{"value": 3}'

Response from the API would look something like:

Response Headers
HTTP/1.0 202 ACCEPTED
Allow: PUT, HEAD, OPTIONS, GET
Content-Length: 397
Content-Type: application/json
Date: Wed, 27 Apr 2016 18:15:08 GMT
Location: https://vss-api.eis.utoronto.ca:8001/v2/request/task/0f39fa9f-4f35-426a-8ebb-8f1b34588fef
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7197
X-RateLimit-Reset: 1461783600
Response Body
{
    "data": {
        "_links": {
            "request": "https://vss-api.eis.utoronto.ca:8001/v2/request/change/3", 
            "task": "https://vss-api.eis.utoronto.ca:8001/v2/request/task/0f39fa9f-4f35-426a-8ebb-8f1b34588fef"
        }, 
        "message": "VM Change Request has been accepted for processing", 
        "name": "Accepted", 
        "state": "Submitted", 
        "status": 202
    }, 
    "meta": {
        "time": "0.03691s", 
        "user": "jm"
    }
}

Remember you can check task and request status by making a GET request to /v2/request/task/<task_id> and /v2/request/change/<change_id> respectively.

 

Virtual Disk

ResourceURIDescriptionGETPOSTPUTDELETEOPTIONS*
Virtual Machine Disk/vm/<vm_uuid>/diskVirtual Machine disk resource. Get VM disks, and capacity.(tick)   (tick)
Virtual Machine Disk Number/vm/<vm_uuid>/disk/<disk_number>

Virtual Machine disk resource. Get specific disk information such as size, controller, provisioning.

 Update size or delete.

(tick)(tick)(tick)(tick)(tick)

Disk List

Virtual machine disks can be listed making a GET request to /v2/<vm_uuid>/disk resource. You will get the list of disks and the Hypermedia reference to the actual disk.

http -a $TK GET "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk"
curl -u $TK -X GET "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk"

Response from the API would look something like:

Response Headers
HTTP/1.0 200 OK
Allow: HEAD, OPTIONS, GET
Content-Length: 652
Content-Type: application/json
Date: Wed, 27 Apr 2016 18:26:42 GMT
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7188
X-RateLimit-Reset: 1461783600
Response Body
{
    "_links": {
        "self": "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/", 
        "vm": "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/"
    }, 
    "data": [
        {
            "_links": {
                "self": "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1"
            }, 
            "capacityGB": 40, 
            "label": "Hard disk 1"
        }, 
        {
            "_links": {
                "self": "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/2"
            }, 
            "capacityGB": 100, 
            "label": "Hard disk 2"
        }
    ], 
    "meta": {
        "count": 2, 
        "time": "0.04253s", 
        "user": "jm"
    }
}

Disk info

Displaying disk specific information such as controller, file, provissioning type, capacity, etc. can be done by making a GET request to /v2/vm/<vm_uuid>/disk/<disk_number> as shown below:

http -a $TK GET "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1"
curl -u $TK -X GET "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1"

Response from the API would look something like:

Response Headers
HTTP/1.0 200 OK
Allow: HEAD, GET, PUT, POST, OPTIONS, DELETE
Content-Length: 688
Content-Type: application/json
Date: Wed, 27 Apr 2016 18:37:30 GMT
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7186
X-RateLimit-Reset: 1461783600
Response Body
{
    "_links": {
        "self": "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1", 
        "vm": "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/"
    }, 
    "data": [
        {
            "capacityGB": 40, 
            "controller": {
                "type": "LSI Logic", 
                "virtualDeviceNode": "SCSI controller 0:0"
            }, 
            "description": "41,943,040 KB", 
            "fileName": "[datastore1] 1604T-Ubuntu3/1604T-Ubuntu3.vmdk", 
            "label": "Hard disk 1", 
            "provisioning": "Thin", 
            "shares": {
                "level": "normal", 
                "shares": 1000
            }
        }
    ], 
    "meta": {
        "count": 1, 
        "time": "0.04598s", 
        "user": "jm"
    }
}

If requested disk does not exist, you'll get a 404 response status as follows:

HTTP Response
HTTP/1.0 404 NOT FOUND
Allow: HEAD, GET, PUT, POST, OPTIONS, DELETE
Content-Length: 118
Content-Type: application/json
Date: Wed, 27 Apr 2016 18:34:19 GMT
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7187
X-RateLimit-Reset: 1461783600
{
    "error": "resource not found", 
    "message": "Hard disk 3 on 1604T-Ubuntu3 could not be found", 
    "status": 404
}

Disk Changes

Update

Updating disks can be submitted by making a PUT request to /vm/<vm_uuid>/disk/<disk_number> with the following JSON object as request body:

{"attribute": "capacity",
 "value": 200}

The value attribute is the size of the new Disk in GB.

http -a $TK PUT "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1" attribute=capacity value=200
curl -u $TK -X PUT "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1" -d '{"attribute": "capacity", "value": 200}'

Response from the API would look something like:

Response Headers
HTTP/1.0 202 ACCEPTED
Allow: HEAD, GET, PUT, POST, OPTIONS, DELETE
Content-Length: 397
Content-Type: application/json
Date: Wed, 27 Apr 2016 18:58:10 GMT
Location: https://vss-api.eis.utoronto.ca:8001/v2/request/task/2f2b7baf-3abf-48f1-8d16-9dc63641a800
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7178
X-RateLimit-Reset: 1461783600
Response Body
{
    "data": {
        "_links": {
            "request": "https://vss-api.eis.utoronto.ca:8001/v2/request/change/8", 
            "task": "https://vss-api.eis.utoronto.ca:8001/v2/request/task/2f2b7baf-3abf-48f1-8d16-9dc63641a800"
        }, 
        "message": "VM Change Request has been accepted for processing", 
        "name": "Accepted", 
        "state": "Submitted", 
        "status": 202
    }, 
    "meta": {
        "time": "0.03962s", 
        "user": "jm"
    }
}

Create

A POST request should be submitted to /vm/<vm_uuid>/disk/<disk_number> in order to create a disk with the following JSON object as request body:

{"value": 80}

The value attribute is the size of the new Disk in GB.

http -a $TK POST "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1" value=200
curl -u $TK -X POST "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1" -d '{"value": 200}'

Response from the API would look something like:

Response Headers
HTTP/1.0 202 ACCEPTED
Allow: HEAD, GET, PUT, POST, OPTIONS, DELETE
Content-Length: 397
Content-Type: application/json
Date: Wed, 27 Apr 2016 18:52:23 GMT
Location: https://vss-api.eis.utoronto.ca:8001/v2/request/task/4ecfa88d-1d1a-44fa-bb9b-d0ab04c17691
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7180
X-RateLimit-Reset: 1461783600
Response Body
{
    "data": {
        "_links": {
            "request": "https://vss-api.eis.utoronto.ca:8001/v2/request/change/7", 
            "task": "https://vss-api.eis.utoronto.ca:8001/v2/request/task/4ecfa88d-1d1a-44fa-bb9b-d0ab04c17691"
        }, 
        "message": "VM Change Request has been accepted for processing", 
        "name": "Accepted", 
        "state": "Submitted", 
        "status": 202
    }, 
    "meta": {
        "time": "0.03387s", 
        "user": "jm"
    }
}

Delete

To delete a disk you must submit a DELETE request to  /vm/<vm_uuid>/disk/<disk_number> with no request body as follows:

http -a $TK DELETE "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1" 
curl -u $TK -X DELETE "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1"

Response from the API would look something like:

Response Headers
HTTP/1.0 202 ACCEPTED
Allow: HEAD, GET, PUT, POST, OPTIONS, DELETE
Content-Length: 397
Content-Type: application/json
Date: Wed, 27 Apr 2016 18:52:23 GMT
Location: https://vss-api.eis.utoronto.ca:8001/v2/request/task/4ecfa88d-1d1a-44fa-bb9b-d0ab04c17691
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7180
X-RateLimit-Reset: 1461783600
Response Body
{
    "data": {
        "_links": {
            "request": "https://vss-api.eis.utoronto.ca:8001/v2/request/change/4", 
            "task": "https://vss-api.eis.utoronto.ca:8001/v2/request/task/e1f77e2d-7323-4f6c-a454-ce2450d7b635"
        }, 
        "message": "VM Change Request has been accepted for processing", 
        "name": "Accepted", 
        "state": "Submitted", 
        "status": 202
    }, 
    "meta": {
        "time": "0.07853s", 
        "user": "jm"
    }
}

Remember you can check task and request status by making a GET request to /v2/request/task/<task_id> and /v2/request/change/<change_id> respectively.

Boot Options

The time when you power on the virtual machine, shows up the BIOS and launches the guest operating system software can be unnoticeable, because by default VMware sets up 0ms as boot delay. However, you can edit boot delay options to change that amount of time or to force the virtual machine to enter the BIOS setup screen after power on. This is done using the Boot resource in the RESTful API /vm/<vm_uuid>/boot.

ResourceURIDescriptionGETPOSTPUTDELETEOPTIONS*
Virtual Machine Boot Options/vm/<vm_uuid>/bootVirtual Machine Boot resource. Get and update boot configuration options.(tick) (tick) (tick)

Boot info

Showing what's currently configured as boot options is done by making a GET request to /vm/<vm_uuid>/boot as follows:

http -a $TK GET "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/boot"
curl -u $TK -X GET "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/boot" 

Response from the API would look something like:

Response Headers
HTTP/1.0 200 OK
Allow: PUT, HEAD, OPTIONS, GET
Content-Length: 366
Content-Type: application/json
Date: Wed, 27 Apr 2016 19:07:54 GMT
Server: Werkzeug/0.11.3 Python/2.7.10
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7199
X-RateLimit-Reset: 1461787200
Response Body
{
    "_links": {
        "self": "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/boot", 
        "vm": "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/"
    }, 
    "data": {
        "bootDelayMs": 5000, 
        "bootRetryDelayMs": 10000, 
        "enterBIOSSetup": false
    }, 
    "meta": {
        "count": 3, 
        "time": "0.07022s", 
        "user": "jm"
    }
}

Boot Changes

Submitting a HTTP request using PUT to /vm/<vm_uuid>/boot is used to update two boot options: bootdelay, to change that amount of time from powering on to boot into the main device in milliseconds and bootbios, which will force to boot directly to the BIOS setup, boolean. The request body expected is a JSON object as follows:

# boot delay data
{"attribute": "bootdelay",
 "value": 10000}
# boot to bios data
{"attribute": "bootbios",
 "value": true}

Updating VMs boot delay can be done as shown below:

http -a $TK PUT "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/boot" attribute=bootdelay value=10000
curl -u $TK -X PUT "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/boot" -d '{"attribute": "bootdelay", "value": 10000}'

Response from the API would look something like:

Response Headers
HTTP/1.0 202 ACCEPTED
Allow: PUT, HEAD, OPTIONS, GET
Content-Length: 397
Content-Type: application/json
Date: Wed, 27 Apr 2016 19:33:47 GMT
Location: https://vss-api.eis.utoronto.ca:8001/v2/request/task/f5de4b0d-6f00-44ae-870a-e2858134b6d0
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7197
X-RateLimit-Reset: 1461787200
Response Body
{
    "data": {
        "_links": {
            "request": "https://vss-api.eis.utoronto.ca:8001/v2/request/change/9", 
            "task": "https://vss-api.eis.utoronto.ca:8001/v2/request/task/f5de4b0d-6f00-44ae-870a-e2858134b6d0"
        }, 
        "message": "VM Change Request has been accepted for processing", 
        "name": "Accepted", 
        "state": "Submitted", 
        "status": 202
    }, 
    "meta": {
        "time": "0.04164s", 
        "user": "jm"
    }
}

Remember you can check task and request status by making a GET request to /v2/request/task/<task_id> and /v2/request/change/<change_id> respectively.

Logical Folder

This sub resource provides access to containing logical folder object in vCenter. 

ResourceURIDescriptionGETPOSTPUTDELETEOPTIONS*
Virtual Machine Folder/vm/<vm_uuid>/folderVirtual Machine containing Folder resource. Get and update containing folder.(tick) (tick) (tick)

Folder info

Querying which folder is this VM on is done by doing a GET request to /v2/vm/<vm_uuid>/folder. 

http -a $TK GET "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/folder"
curl -u $TK -X GET "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/folder" 

Response from the API would look something like:

Response Headers
HTTP/1.0 200 OK
Allow: PUT, HEAD, OPTIONS, GET
Content-Length: 508
Content-Type: application/json
Date: Wed, 27 Apr 2016 19:42:16 GMT
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7196
X-RateLimit-Reset: 1461787200

The result will provide basic info about the folder such as nameparent and full path. Also, it provides a Hypermedia resource to the main /v2/folder/<moref> resource.

Response Body
{
    "_links": {
        "self": "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/folder", 
        "vm": "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/"
    }, 
    "data": {
        "folder": {
            "_links": {
                "self": "https://vss-api.eis.utoronto.ca:8001/v2/folder/group-v4122"
            }, 
            "moref": "group-v4122"
        }, 
        "full_path": "VSS > Sandbox > jm", 
        "name": "jm", 
        "parent": "Sandbox"
    }, 
    "meta": {
        "count": 4, 
        "time": "0.09257s", 
        "user": "jm"
    }
}

Folder Update

Moving a VM to a specific logical folder is done by making a PUT request to /v2/vm/<vm_uuid>/folder with the moref (Managed object Reference) of the target folder, which can be obtained from the /v2/folder/ resource. The request body expected is a JSON object as shown below:

{"value": "group-v6736"}

Submitting a change request to update VMs logical folder can be done as follows:

http -a $TK PUT "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/folder" value=group-v6736
curl -u $TK -X PUT "https://vss-api.eis.utoronto.ca:8001/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/folder" -d '{"value": "group-v6736"}'

Response from the API would look something like:

Response Headers
HTTP/1.0 202 ACCEPTED
Allow: PUT, HEAD, OPTIONS, GET
Content-Length: 398
Content-Type: application/json
Date: Wed, 27 Apr 2016 19:57:45 GMT
Location: https://vss-api.eis.utoronto.ca:8001/v2/request/task/b3a2c488-ebdb-4d27-9ceb-a5c1d3085672
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7192
X-RateLimit-Reset: 1461787200
Response Body
{
    "data": {
        "_links": {
            "request": "https://vss-api.eis.utoronto.ca:8001/v2/request/change/10", 
            "task": "https://vss-api.eis.utoronto.ca:8001/v2/request/task/b3a2c488-ebdb-4d27-9ceb-a5c1d3085672"
        }, 
        "message": "VM Change Request has been accepted for processing", 
        "name": "Accepted", 
        "state": "Submitted", 
        "status": 202
    }, 
    "meta": {
        "time": "0.05744s", 
        "user": "jm"
    }
}

Remember you can check task and request status by making a GET request to /v2/request/task/<task_id> and /v2/request/change/<change_id> respectively.

Name

Guest Operating System

Network Interface Card

 

  • No labels