Virtual Machine - Attributes

Summary

ResourceURIDescriptionGETPOSTPUTDELETEPATCH
CPU/vm/<vm-id>/cpuCPU resource. Get CPU count, quick stats and update cpu count(tick)
(tick)

CPU settings/vm/<vm-id>/cpu/configCPU settings. Get and update CPU Hot add/remove setting(tick)
(tick)

Memory/vm/<vm-id>/memoryMemory resource. Get Memory count, quick stats and update memory size(tick)
(tick)

Firmware/vm/<vm-id>/firmwareGet or update firmware type.(tick)
(tick)

Disk/vm/<vm-id>/diskDisk resource. List, create and delete virtual disks.(tick) (tick)
 (tick)
Disk Unit/vm/<vm-id>/disk/<disk_number>

Get specific disk information such as size, controller, provisioning. List update and delete virtual Disk.

(tick)
(tick)(tick)
Disk Unit Backing/vm/<vm-id>/disk/<disk_number>/backingGet physical VMDK file backing and more information.(tick)



Disk Unit SCSI controller/vm/<vm-id>/disk/<disk_number>/scsiGet and update SCSI adapter of a given disk unit(tick)
(tick)

Disk Unit Sharing/vm/<vm-id>/disk/<disk_number>/sharingGet and update Disk Sharing(tick)
(tick)

Controllers/vm/<vm-id>/controllerIO Controllers including SCSI and IDE(tick)



SCSI Controllers/vm/<vm-id>/controller/scsiAvailable SCSI controllers in the VM. Create, list and delete SCSI controllers(tick)(tick)
(tick)
SCSI Controller/vm/<vm-id>/controller/scsi/<bus>Get a specific SCSI controller info. Update controller type or delete given controller(tick)
(tick)(tick)
Floppy/vm/<vm-id>/floppyFloppy resource. List available floppy units.(tick)



Floppy Number/vm/<vm-id>/floppy/<unit>List current Floppy unit and update backend configuration.(tick)
(tick)

CD/DVD/vm/<vm-id>/cdCD/DVD resource. List VM cd/dvd units.(tick)



CD/DVD Number/vm/<vm-id>/cd/<unit>CD/DVD unit resource. List current CD/DVD unit and update backend configuration.(tick)
(tick)

Boot Options/vm/<vm-id>/bootBoot resource. Get and update boot configuration options.(tick)
(tick)

Logical Folder/vm/<vm-id>/folderLogical Folder resource. Get and update containing folder.(tick)
(tick)

Name/vm/<vm-id>/nameInstance name. List and update assigned name without VSS prefix(tick)
(tick)

Network Interface Card/vm/<vm-id>/nicNetwork interface list.(tick) (tick)
 (tick)
Network Interface Card Number/vm/<vm-id>/nic/<unit>Network interface unit. List, create, update or delete NIC.(tick)
(tick)(tick)
Template/vm/<vm_uuid/template

Template state. Mark VM as template or template as VM.

(tick)
(tick)

Operating System/vm/<vm_uuid/osConfigured Operating System(tick)
(tick)

Guest/vm/<vm-id>/guestRunning Guest related configuration(tick)



Guest Operating System/vm/<vm-id>/guest/osRunning Operating System configuration(tick)
(tick)

Guest VMware Tools/vm/<vm-id>/guest/toolsGuest VMware Tools configuration.(tick)
(tick)

Guest Network/vm/<vm-id>/guest/netGuest network configuration.(tick)



Guest Network IP/vm/<vm-id>/guest/net/ipGuest network Ip address configuration.(tick)



Guest Process/vm/<vm-id>/guest/cmdGuest running processes or execute program(tick)(tick)


Guest Process ID/vm/<vm-id>/guest/cmd/<pid>Guest process management(tick)

(tick)(tick)
State/vm/<vm-id>/statePower state.(tick)
(tick)

Domain/vm/<vm-id>/domainFault domain.(tick)
(tick)

Triggered Alarms

/vm/<vm-id>/alarm

/vm/<vm-id>/alarm/<moref>

Triggered Alarms. Shows list of triggered alarms.

Specific Triggered Alarms. Lists, clears and acknowledges alarm.

(tick)
(tick)

Events

/vm/<vm-id>/event

/vm/<vm-id>/alarm/<hour_window>

Instance related vCenter events within 1 hour by default.(tick)



Note/vm/<vm-id>/noteInstance Annotation. List raw virtual Machine annotation.(tick)



Client Notes/vm/<vm-id>/note/clientMetadata Client custom notes if any.(tick)
(tick)

Snapshots

/vm/<vm-id>/snapshot

/vm/<vm-id>/snapshot/<snapshot_id>

Virtual Machine Snapshot resource. List or create VM snapshots.

List, delete and restore from <snapshot_id>

(tick)(tick)
(tick)(tick)
Disk Consolidation/vm/<vm-id>/snapshot/consolidateDisk consolidation status. List if disk consolidation is required and execute consolidation(tick)
(tick)

Performance/vm/<vm-id>/performancePerformance statistics, including datastore IO, memory, CPU and network.(tick)



Console/vm/<vm-id>/consoleHTML5 one-time console link.(tick)



Export/vm/<vm-id>/exportOVF export action to vskey-stor.
(tick)


VMX Version/vm/<vm-id>/versionVirtual hardware version and upgrade policy.(tick)
(tick)

Extra Configuration/vm/<vm-id>/extra-configManage VMware **guestinfo** interface options, which are available to the VM guest operating system via VMware Tools. (tick)(tick)(tick)(tick)(tick)
VSS/vm/<vm-id>/vssVSS related metadata.(tick)



VSS Admin/vm/<vm-id>/vss/adminAdministrator. List or update VM admin name and contact info.(tick)
(tick)

VSS Inform/vm/<vm-id>/vss/informInformational contacts. List or update VM informational contacts.(tick)
(tick)

VSS Usage/vm/<vm-id>/vss/usageInstance designated usage.(tick)
(tick)

VSS HA Group/vm/<vm-id>/vss/ha-groupHA group metadata.(tick)
(tick)
(tick)
VSS Client/vm/<vm-id>/vss/clientClient Department(tick)
(tick)

VSS Description/vm/<vm-id>/vss/descriptionDescription(tick)
(tick)

VSS Options/vm/<vm-id>/vss/optionVSS Options(tick)(tick)(tick)(tick)
VSS Service/vm/<vm-id>/vss/serviceVSS Service.(tick)
(tick)(tick)
Configuration specification/vm/<vm-id>/specInstance spec. Will dump VM specifications (shell).(tick)
(tick) 

Guest OS Customization Specification/vm/<vm-id>/custom-specGuest os customization specification.
(tick)


<vm-id> is either Managed Object Reference Id or UUID.

TK stores the Cloud API Token generated as a result of the following POST request to the /auth/request-token resource:

curl -X POST https://vss-api.eis.utoronto.ca/auth/request-token -u <username>

For example, extracting the token with the jq command:

TK=$(curl -X POST https://vss-api.eis.utoronto.ca/auth/request-token -u <username> | jq '.token')

CPU

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

Info

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

http GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cpu" "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/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/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cpu", 
        "vm": "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/"
    }, 
    "data": {
        "coresPerSocket": 1,
        "cpu": 3,
        "hotAdd": {
            "enabled": true
        },
        "hotRemove": {
            "enabled": false
        },
        "quickStats": {
            "overallCpuDemandMHz": 72,
            "overallCpuUsageMHz": 72
        }
    }, 
    "meta": {
        "count": 2, 
        "time": "0.03721s", 
        "user": "jm"
    }
}

Update

Increasing or decreasing CPU and Cores Per Socket can be done by making a PUT request to /vm/<vm-id>/cpu as shown below:

http PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cpu" value:=3 "Authorization: Bearer $TK"

curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cpu" -d '{"value": 3}'

curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cpu" -d '{"value": {"count": 4, "cores_per_socket": 2}}'

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/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/v2/request/change/2", 
            "task": "https://vss-api.eis.utoronto.ca/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*
Memory/vm/<vm-id>/memoryVirtual Machine Memory resource. Get Memory count, quick stats and update memory size(tick)
(tick)
(tick)

Info

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

http GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/memory" "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/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/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/memory", 
        "vm": "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/"
    }, 
    "data": {
        "hotAdd": {
            "enabled": true,
            "limitGB": 128.0
        },
        "memoryGB": 8.0,
        "quickStats": {
            "balloonedMemoryMB": 0,
            "compressedMemoryKB": 0,
            "consumedOverheadMemoryMB": 59,
            "guestMemoryUsageMB": 737,
            "privateMemoryMB": 8117,
            "sharedMemoryMB": 75,
            "swappedMemoryMB": 0
        }
    },
    "meta": {
        "count": 2, 
        "time": "0.02911s", 
        "user": "jm"
    }
}

Update

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

http PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/memory" value:=3 "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X PUT "https://vss-api.eis.utoronto.ca/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/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/v2/request/change/3", 
            "task": "https://vss-api.eis.utoronto.ca/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*
Disk/vm/<vm-id>/diskVirtual Machine disk resource. Get VM disks, and capacity.(tick)(tick) 
(tick) (tick)
Disk Number/vm/<vm-id>/disk/<disk_number>

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

 Update size or delete.

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

List

Virtual Disks can be listed by a GET request to /v2/<vm-id>/disk resource. You will get the list of disks and the Hypermedia reference to the every disk available in the VM:

http GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk" "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/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/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/", 
        "vm": "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/"
    }, 
    "data": [
        {
            "_links": {
                "self": "http://localhost:5000/v2/vm/5012c92a-3dac-cd2f-ce56-bda704ca51b8/disk/1"
            },
            "capacityGB": 40.0,
            "unit": "1"
        },
        {
            "_links": {
                "self": "http://localhost:5000/v2/vm/5012c92a-3dac-cd2f-ce56-bda704ca51b8/disk/2"
            },
            "capacityGB": 100.0,
            "unit": "2"
        }
    ],
    "meta": {
        "count": 2, 
        "time": "0.04253s", 
        "user": "jm"
    }
}

Info

Displaying specific information of a disk such as controller, backing file, provisioning, capacity, etc. can be done by a GET request to /v2/vm/<vm-id>/disk/<disk_number> as shown below:

http GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1" "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/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/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1", 
        "vm": "https://vss-api.eis.utoronto.ca/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
}

Update

PUT request to /vm/<vm-id>/disk/<disk_number> will submit a change request to update capacity. The following JSON object is expected as request body:

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

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

http PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1" attribute=capacity value=200 "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X PUT "https://vss-api.eis.utoronto.ca/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/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/v2/request/change/8", 
            "task": "https://vss-api.eis.utoronto.ca/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

POST request should be made to /vm/<vm-id>/disk in order to create a disk or multiple with the following JSON object as request body:

{"value": [80, 100, 100]}

The value of the key value is either the new size of the Disk in GB or for advanced setup, the following object structure:

[{"capacity_gb": 80, "backing_mode": "persistent", "backing_sharing": "sharingnone" "backing_vmdk": "<vssUsers_path>"}]


http POST "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk" value:='[80, 100, 100]' "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X POST "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk" -d '{"value": [80, 100, 100]}'

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/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/v2/request/change/7", 
            "task": "https://vss-api.eis.utoronto.ca/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 or multiple disks you must submit a DELETE request to  /vm/<vm-id>/disk/<disk_number> with no request body as follows:

# Just one disk 
http DELETE "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1" "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -X DELETE "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1"


# Disk labels in array
http DELETE "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk" value:='[2,3]' "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -X DELETE "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/disk/1" -d '{"value": [2,3]}'

This action cannot be undone.

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/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/v2/request/change/4", 
            "task": "https://vss-api.eis.utoronto.ca/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.

Floppy

List

Virtual Floppy units are listed by making a GET request to /v2/<vm_uuid/floppy which will return a list of available units to display further information from:

http GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/floppy" "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/floppy"

Response from the API would look something like:

Response Headers
HTTP/1.1 200 OK
Allow: HEAD, OPTIONS, GET
Connection: keep-alive
Content-Length: 521
Content-Type: application/json
Date: Mon, 27 Jun 2016 15:14:16 GMT
Server: nginx
Strict-Transport-Security: max-age=63072000
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-RateLimit-Limit: 3000
X-RateLimit-Remaining: 2999
X-RateLimit-Reset: 1467043200
Response Body
{
    "_links": {
        "self": "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/floppy",
        "vm": "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607"
    },
    "data": [
        {
            "_links": {
                "self": "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/floppy/1"
            },
            "backing": "client",
            "label": "Floppy drive 1"
        }
    ],
    "meta": {
        "count": 1,
        "time": "0.05602s",
        "user": "jm"
    }
}

In this particular case, the floppy unit has no image as backend device.

Info

Displaying specific information of a disk such as controllerbacking file, etc. can be done by a GET request to /v2/vm/<vm-id>/floppy/<floppy_number> as shown below:

Response from the API would look something like:

Response Headers
HTTP/1.1 200 OK
Allow: PUT, HEAD, OPTIONS, GET
Connection: keep-alive
Content-Length: 620
Content-Type: application/json
Date: Mon, 27 Jun 2016 15:16:38 GMT
Server: nginx
Strict-Transport-Security: max-age=63072000
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-RateLimit-Limit: 3000
X-RateLimit-Remaining: 2998
X-RateLimit-Reset: 1467043200
Response Body
{
    "_links": {
        "floppy": "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/floppy",
        "self": "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/floppy/1"
    },
    "data": [
        {
            "backing": "client",
            "connected": "Disconnected",
            "controller": {
                "type": "SIO controller 0",
                "virtualDeviceNode": "SIO controller 0:0"
            },
            "description": "Remote",
            "key": 8000,
            "label": "Floppy drive 1",
            "unit": 0
        }
    ],
    "meta": {
        "count": 1,
        "time": "0.05800s",
        "user": "jm"
    }
}

Update

Virtual Floppy units are not quite used as CD/DVDs, however, when the operating system is Windows and the VM has been configured with Paravirtual SCSI (PVSCSI) controllers, the installer requires to load VMwrare drivers to successfully see all virtual disks attached to PVSCSI controller. The drivers are available to mount from all ESXi hosts in [] /vmimages/floppies.

A PUT request to /vm/<vm-id>/floppy/<floppy_number> will submit a change request to update device backing, meaning client or floppy image. The following JSON object is expected as request body:

# floppy image
{"attribute": "img",
 "value": "[] /vmimages/floppies/pvscsi-Windows2008.flp"}
# client
{"attribute": "client",
 "value": ""}

Making the HTTP request would look like:

httpPUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/floppy/1" attribute=img value='[] /vmimages/floppies/pvscsi-Windows2008.flp' "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/floppy/1" -d '{"attribute": "img", "value": "[] /vmimages/floppies/pvscsi-Windows2008.flp"}'

Response from the API would look something like:

Response Headers
HTTP/1.1 202 ACCEPTED
Allow: PUT, HEAD, OPTIONS, GET
Connection: keep-alive
Content-Length: 431
Content-Type: application/json
Date: Mon, 27 Jun 2016 15:20:10 GMT
Location: https://vss-api.eis.utoronto.ca/v2/request/task/6e52bcc5-0abf-4f12-89ab-5f1e4f17b896
Server: nginx
X-RateLimit-Limit: 3000
X-RateLimit-Remaining: 2997
X-RateLimit-Reset: 1467043200
Response Body
{
    "data": {
        "_links": {
            "request": "https://vss-api.eis.utoronto.ca/v2/request/change/52",
            "task": "https://vss-api.eis.utoronto.ca/v2/request/task/6e52bcc5-0abf-4f12-89ab-5f1e4f17b896"
        },
        "message": "VM Change Request has been accepted for processing",
        "name": "Accepted",
        "state": "Submitted",
        "status": 202
    },
    "meta": {
        "time": "0.53142s",
        "user": "jm"
    }
}

CD/DVD

List

Virtual CD/DVD units can be listed by a GET request to /v2/<vm-id>/cd resource. You will get the list of cd/dvd and the Hypermedia reference to the every unit available in the VM:

http GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cd" "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cd"

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/v2/vm/50125944-d5e0-248d-0f3c-c499acbeb1ce/cd",
        "vm": "https://vss-api.eis.utoronto.ca/v2/vm/50125944-d5e0-248d-0f3c-c499acbeb1ce"
    },
    "data": [
        {
            "_links": {
                "self": "http://localhost:5000/v2/vm/50127974-aa4a-c215-f9f0-e1ab8a4ef050/cd/1"
            },
            "backing": "[vss-ISOs] Windows/W10/Win10_English_x32.iso",
            "label": "CD/DVD drive 1"
    ],
    "meta": {
        "count": 1,
        "time": "0.05149s",
        "user": "jm"
    }
}

Info

Displaying specific information of a disk such as controllerbacking file, etc. can be done by a GET request to /v2/vm/<vm-id>/cd/<cd_number> as shown below:

http GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cd/1" "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cd/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/v2/vm/50125944-d5e0-248d-0f3c-c499acbeb1ce/cd/1",
        "vm": "https://vss-api.eis.utoronto.ca/v2/vm/50125944-d5e0-248d-0f3c-c499acbeb1ce"
    },
    "data": [
        {
            "backing": "client",
            "connected": "Disconnected",
            "controller": {
                "type": "IDE 1",
                "virtualDeviceNode": "IDE 1:0"
            },
            "description": "Remote device",
            "key": 3002,
            "label": "CD/DVD drive 1",
            "unit": 0
        }
    ],
    "meta": {
        "count": 1,
        "time": "0.04461s",
        "user": "jm"
    }
}

If requested a non existent CD/DVD unit, 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": "CD/DVD drive 2 on 1604T-Ubuntu3 could not be found", 
    "status": 404
}

Update

A PUT request to /vm/<vm-id>/cd/<cd_number> will submit a change request to update device backing, meaning client or iso image. The following JSON object is expected as request body:

# iso image
{"attribute": "iso",
 "value": "[vss-ISOs] Windows/W10/Win10_English_x32.iso"}
# client
{"attribute": "client",
 "value": ""}

The ISO API resource provides a list of available ISOs to mount to the VM.

Making the HTTP request would look like:

http PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cd/1" attribute=iso value='[vss-ISOs] Windows/W10/Win10_English_x32.iso' "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/cd/1" -d '{"attribute": "iso", "value": "[vss-ISOs] Windows/W10/Win10_English_x32.iso"}'

Response from the API would look something like:

Response Headers
HTTP/1.1 202 ACCEPTED
Allow: PUT, HEAD, OPTIONS, GET
Connection: keep-alive
Content-Length: 428
Content-Type: application/json
Date: Fri, 20 May 2016 18:04:41 GMT
Location: https://vss-api.eis.utoronto.ca/v2/request/task/9b815488-e0d9-4b60-a94f-fe9b0fe46ec7
Server: nginx
X-RateLimit-Limit: 3000
X-RateLimit-Remaining: 2993
X-RateLimit-Reset: 1463770800
Response Body
{
    "data": {
        "_links": {
            "request": "https://vss-api.eis.utoronto.ca/v2/request/change/18",
            "task": "https://vss-api.eis.utoronto.ca/v2/request/task/9b815488-e0d9-4b60-a94f-fe9b0fe46ec7"
        },
        "message": "VM Change Request has been accepted for processing",
        "name": "Accepted",
        "state": "Submitted",
        "status": 202
    },
    "meta": {
        "time": "0.21971s",
        "user": "jm"
    }
}

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-id>/boot.

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

Info

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

http GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/boot" "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/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
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7199
X-RateLimit-Reset: 1461787200
Response Body
{
    "_links": {
        "self": "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/boot", 
        "vm": "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/"
    }, 
    "data": {
        "bootDelayMs": 5000, 
        "bootRetryDelayMs": 10000, 
        "enterBIOSSetup": false
    }, 
    "meta": {
        "count": 3, 
        "time": "0.07022s", 
        "user": "jm"
    }
}

Update

Submitting a HTTP request using PUT to /vm/<vm-id>/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 PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/boot" attribute=bootdelay value=10000 "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X PUT "https://vss-api.eis.utoronto.ca/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/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/v2/request/change/9", 
            "task": "https://vss-api.eis.utoronto.ca/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*
Folder/vm/<vm-id>/folderVirtual Machine containing Folder resource. Get and update containing folder.(tick)
(tick)
(tick)

Info

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

http GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/folder" "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/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/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/folder", 
        "vm": "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/"
    }, 
    "data": {
        "folder": {
            "_links": {
                "self": "https://vss-api.eis.utoronto.ca/v2/folder/group-v4122"
            }, 
            "moref": "group-v4122"
        }, 
        "full_path": "VSS > Sandbox > jm", 
        "name": "jm", 
        "parent": "Sandbox"
    }, 
    "meta": {
        "count": 4, 
        "time": "0.09257s", 
        "user": "jm"
    }
}

Update

Moving a VM to a specific logical folder is done by making a PUT request to /v2/vm/<vm-id>/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 PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/folder" value=group-v6736 "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X PUT "https://vss-api.eis.utoronto.ca/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/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/v2/request/change/10", 
            "task": "https://vss-api.eis.utoronto.ca/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

ResourceURIDescriptionGETPOSTPUTDELETEOPTIONS*
Name/vm/<vm-id>/nameVirtual Machine human readable name. List and update assigned name without VSS prefix(tick)
(tick)
(tick)

Info

Requesting Name info can be as easy as making a GET request to /vm/<vm-id>/name as shown below:

http GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/name" "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/name"

Respose from the API would look something like:

Response Headers
HTTP/1.0 200 OK
Allow: PUT, HEAD, OPTIONS, GET
Content-Length: 309
Content-Type: application/json
Date: Thu, 28 Apr 2016 19:34:48 GMT
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7199
X-RateLimit-Reset: 1461873600
Response Body
{
    "_links": {
        "self": "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/name", 
        "vm": "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/"
    }, 
    "data": {
        "name": "1604T-Ubuntu3"
    }, 
    "meta": {
        "count": 1, 
        "time": "0.04409s", 
        "user": "jm"
    }
}

Update

Renaming a Virtual Machine can be done by making a PUT request to /vm/<vm-id>/name as shown below:

http PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/name" value=Ubuntu4 "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X PUT "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/name" -d '{"value": "Ubuntu4"}'

VSS prefix must not be included, if included the API will return a 400 error:

Response
HTTP/1.0 400 BAD REQUEST
Allow: PUT, HEAD, OPTIONS, GET
Content-Length: 122
Content-Type: application/json
Date: Thu, 28 Apr 2016 19:37:16 GMT
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7198
X-RateLimit-Reset: 1461873600
{
    "message": "New Virtual Machine name must not contain VSS prefix", 
    "options": [
        "value"
    ], 
    "status": 400
}

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: Thu, 28 Apr 2016 17:46:12 GMT
Location: https://vss-api.eis.utoronto.ca/v2/request/task/e84558b9-4d18-41d2-9f4f-3ec873d37441
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7194
X-RateLimit-Reset: 1461866400
Response Body
{
    "data": {
        "_links": {
            "request": "https://vss-api.eis.utoronto.ca/v2/request/change/13", 
            "task": "https://vss-api.eis.utoronto.ca/v2/request/task/e84558b9-4d18-41d2-9f4f-3ec873d37441"
        }, 
        "message": "VM Change Request has been accepted for processing", 
        "name": "Accepted", 
        "state": "Submitted", 
        "status": 202
    }, 
    "meta": {
        "time": "0.12066s", 
        "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.

Network Interface Card

ResourceURIDescriptionGETPOSTPUTDELETEOPTIONS*
NIC/vm/<vm-id>/nicVirtual Machine nic resource. Get VM nic list.(tick) (tick)
(tick)(tick)
NIC Number/vm/<vm-id>/nic/<nic_number>

Virtual Machine specific network interface. List, create, update or delete NIC.

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

List

Virtual machine nics can be listed making a GET request to /v2/<vm-id>/nic resource. You will get the list of nics and the Hypermedia reference to the actual nic for further actions and properties.

http GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/nic" "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/v2/vm/50125d11-a8d6-2af7-c01e-dc6f6be0e607/nic"

Response from the API would look something like:

Response Headers
HTTP/1.0 200 OK
Allow: HEAD, OPTIONS, GET
Content-Length: 820
Content-Type: application/json
Date: Thu, 28 Apr 2016 20:42:39 GMT
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7184
X-RateLimit-Reset: 1461877200
Response Body
{
    "_links": {
        "self": "https://vss-api.eis.utoronto.ca/v2/vm/501210c6-7d40-b31f-b326-f66325ca27a0/nic", 
        "vm": "https://vss-api.eis.utoronto.ca/v2/vm/501210c6-7d40-b31f-b326-f66325ca27a0/"
    }, 
    "data": [
        {
            "_links": {
                "self": "https://vss-api.eis.utoronto.ca/v2/vm/5012c92a-3dac-cd2f-ce56-bda704ca51b8/nic/1"
            },
            "macAddress": "00:50:56:92:71:dc",
            "network": {
                "_links": {
                    "self": "https://vss-api.eis.utoronto.ca/v2/network/dvportgroup-95"
                },
                "moref": "dvportgroup-95"
            },
            "unit": "1"
        }
    ], 
    "meta": {
        "count": 2, 
        "time": "0.59341s", 
        "user": "jm"
    }
}

Info

Displaying NIC specific information such as connection state, network, type, etc. can be done by making a GET request to /v2/vm/<vm-id>/nic/<nic_number> as shown below:

http GET "https://vss-api.eis.utoronto.ca/v2/vm/501210c6-7d40-b31f-b326-f66325ca27a0/nic/1" "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -X GET "https://vss-api.eis.utoronto.ca/v2/vm/501210c6-7d40-b31f-b326-f66325ca27a0/nic/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: 534
Content-Type: application/json
Date: Thu, 28 Apr 2016 20:47:35 GMT
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7181
X-RateLimit-Reset: 1461877200
Response Body
  {
    "address_type": "assigned",
    "connected": true,
    "key": 4000,
    "label": "Network adapter 1",
    "mac_address": "00:50:56:b0:2e:00",
    "network": {
      "_links": {
        "self": "https://vss-api.eis.utoronto.ca/v2/network-vc/dvportgroup-1094"
      },
      "moref": "dvportgroup-1094",
      "name": "VL-1228-DCB-MGMT"
    },
    "start_connected": true,
    "type": "vmxnet3",
    "unit": 1
  }

If requested nic 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: 124
Content-Type: application/json
Date: Thu, 28 Apr 2016 20:48:33 GMT
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7180
X-RateLimit-Reset: 1461877200
{
    "error": "resource not found", 
    "message": "Network adapter 5 on 1604T-Ubuntu2 could not be found", 
    "status": 404
}

Update

There are two updates available to Network Interface Cards: network, state, type. Backend network updates require the Network Managed Object Reference which can be got from /v2/network/ resource, such as dvportgroup-00. NIC state on the other hand, has two options connect and disconnect given NIC. Finally, NIC type means which network adapter should be used between vmxnet3, vmxnet3, e1000, e1000e. Updates to NICs should be made by making a PUT request to /vm/<vm-id>/nic/<nic_number> with the following JSON object as request body:

# update network backend
{"attribute": "network",
 "value": "dvportgroup-00"}
# update state
{"attribute": "state",
 "value": "connect"}
# update nic adapter
{"attribute": "type",
 "value": "vmxnet2"}

For instance, updating NIC 1 type to VMXNET2 is done as follows:

http PUT "https://vss-api.eis.utoronto.ca/v2/vm/501210c6-7d40-b31f-b326-f66325ca27a0/nic/1" attribute=type value=VMXNET2 "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X PUT "https://vss-api.eis.utoronto.ca/v2/vm/501210c6-7d40-b31f-b326-f66325ca27a0/nic/1" -d '{"attribute": "type", "value": "vmxnet2"}'

Response from the API would look something like:

Response Headers
HTTP/1.0 202 ACCEPTED
Allow: HEAD, GET, PUT, POST, OPTIONS, DELETE
Content-Length: 398
Content-Type: application/json
Date: Thu, 28 Apr 2016 20:59:23 GMT
Location: https://vss-api.eis.utoronto.ca/v2/request/task/e6f4313c-5ffa-4e8c-8c52-b368cd08aa62
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7173
X-RateLimit-Reset: 1461877200
Response Body
{
    "data": {
        "_links": {
            "request": "https://vss-api.eis.utoronto.ca/v2/request/change/19", 
            "task": "https://vss-api.eis.utoronto.ca/v2/request/task/e6f4313c-5ffa-4e8c-8c52-b368cd08aa62"
        }, 
        "message": "VM Change Request has been accepted for processing", 
        "name": "Accepted", 
        "state": "Submitted", 
        "status": 202
    }, 
    "meta": {
        "time": "0.04027s", 
        "user": "jm"
    }
}

Create

POST request should be submitted to /vm/<vm-id>/nic in order to create Network Interface Controllers with the Network MOREFs and Network Type in an array as value of the value key in JSON object sent as request body:

{"value": [{"network": "dvportgroup-00"}, {"network": "dvportgroup-01", "type": "vmxnet2"}]}

The value attribute is the Network MOREF.

curl -H "Authorization: Bearer $TK" -H "Content-Type: application/json" -X POST "https://vss-api.eis.utoronto.ca/v2/vm/501210c6-7d40-b31f-b326-f66325ca27a0/nic" -d '{"value": [{"network": "dvportgroup-00"}, {"network": "dvportgroup-01", "type": "vmxnet2"}]}'

Response from the API would look something like:

Response Headers
HTTP/1.0 202 ACCEPTED
Allow: HEAD, GET, PUT, POST, OPTIONS, DELETE
Content-Length: 398
Content-Type: application/json
Date: Fri, 29 Apr 2016 02:07:51 GMT
Location: https://vss-api.eis.utoronto.ca/v2/request/task/20e01be9-b91e-4db2-9e0d-66dbe602b536
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7194
X-RateLimit-Reset: 1461898800
Response Body
 {
    "data": {
        "_links": {
            "request": "https://vss-api.eis.utoronto.ca/v2/request/change/21", 
            "task": "https://vss-api.eis.utoronto.ca/v2/request/task/20e01be9-b91e-4db2-9e0d-66dbe602b536"
        }, 
        "message": "VM Change Request has been accepted for processing", 
        "name": "Accepted", 
        "state": "Submitted", 
        "status": 202
    }, 
    "meta": {
        "time": "0.05490s", 
        "user": "jm"
    }
}

Delete

To delete a NIC you must submit a DELETE request to  /vm/<vm-id>/nic/<nic_number> with no request body as follows:

http DELETE "https://vss-api.eis.utoronto.ca/v2/vm/501210c6-7d40-b31f-b326-f66325ca27a0/nic/1" "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -X DELETE "https://vss-api.eis.utoronto.ca/v2/vm/501210c6-7d40-b31f-b326-f66325ca27a0/nic/1"


# multiple nic deletion delting network adapter 2 and 3
http DELETE "https://vss-api.eis.utoronto.ca/v2/vm/501210c6-7d40-b31f-b326-f66325ca27a0/nic" value:='[2, 3]' "Authorization: Bearer $TK"
curl -H "Authorization: Bearer $TK" -X DELETE "https://vss-api.eis.utoronto.ca/v2/vm/501210c6-7d40-b31f-b326-f66325ca27a0/nic" -d '{2, 3}'

This action cannot be undone.


Response from the API would look something like:

Response Headers
HTTP/1.0 202 ACCEPTED
Allow: HEAD, GET, PUT, POST, OPTIONS, DELETE
Content-Length: 398
Content-Type: application/json
Date: Fri, 29 Apr 2016 02:05:36 GMT
Location: https://vss-api.eis.utoronto.ca/v2/request/task/372da560-bc66-4ffa-a97e-f0b160a1e26f
X-RateLimit-Limit: 7200
X-RateLimit-Remaining: 7195
X-RateLimit-Reset: 1461898800
Response Body
 {
    "data": {
        "_links": {
            "request": "https://vss-api.eis.utoronto.ca/v2/request/change/20", 
            "task": "https://vss-api.eis.utoronto.ca/v2/request/task/372da560-bc66-4ffa-a97e-f0b160a1e26f"
        }, 
        "message": "VM Change Request has been accepted for processing", 
        "name": "Accepted", 
        "state": "Submitted", 
        "status": 202
    }, 
    "meta": {
        "time": "0.13275s", 
        "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.

Template

Virtual Machine Templates are useful If you create a virtual machine that you want to clone frequently, offering a more secure way of preserving a virtual machine configuration, since they are more difficult to alter than ordinary virtual machine. Templates are commonly referred as Master Copy of certain virtual machine, thus any virtual machine can be marked as template.

ResourceURIDescriptionGETPOSTPUTDELETEOPTIONS*
Template/vm/<vm_uuid/templateVirtual Machine Template state. Mark VM as template or template as VM.(tick)