Policy > Inventory > Virtual Machines

Return the List of Virtual Machines

Returns information about all virtual machines.
If you have not added NSX tags on the VM or removed
all the NSX tags that were earlier added to the VM,
then tags property is not returned in the API response.

Request:

Method:
GET
URI Path(s):
/api/v1/fabric/virtual-machines
Request Headers:
n/a
Query Parameters:
VirtualMachineListRequestParameters+
Request Body:
n/a

Example Request:

GET https://<nsx-mgr>/api/v1/fabric/virtual-machines

Successful Response:

Response Code:
200 OK
Response Headers:
Content-type: application/json
Response Body:
VirtualMachineListResult+

Example Response:

{ "result_count" : 1, "results" : [ { "display_name" : "Iws-2", "resource_type" : "VirtualMachine", "local_id_on_host": "1", "external_id" : "420e72c9-55e7-a4f7-81bf-673a2af1a6cf", "host_id" : "cf0ffd7a-818a-11e4-9ab1-cb7a79b0af39", "compute_ids" : [ "locationId:420e72c9-55e7-a4f7-81bf-673a2af1a6cf", "instanceUuid:500e0c08-2ecc-2609-d9ba-ed489e48c787", "biosUuid:420e72c9-55e7-a4f7-81bf-673a2af1a6cf", "externalId:420e72c9-55e7-a4f7-81bf-673a2af1a6cf", "hostLocalId:1", "moIdOnHost:1" ], "source" : { "target_display_name" : "sc2-rdops-vm03-dhcp-102-35.eng.vmware.com", "is_valid" : true, "target_type" : "HostNode", "target_id" : "3d0574b8-267c-11e7-9126-0febdf149b8c" }, "type" : "REGULAR", "power_state" : "VM_RUNNING", "guest_info": { "os_name": "Ubuntu Linux (64-bit)", "computer_name": "app-vm" }, "_last_sync_time" : 1493291539130 } ] } { "result_count": 1, "results": [ { "resource_type": "VirtualMachine", "display_name": "app-vm", "compute_ids": [ "instanceUuid:5006d98a-352f-134f-df6b-33e7f8d5de65", "moIdOnHost:1", "externalId:5006d98a-352f-134f-df6b-33e7f8d5de65", "hostLocalId:1", "locationId:564d1012-15a8-dd22-9c13-f53d697678a8", "biosUuid:4206a555-5a2f-edaa-d215-dac9508da942" ], "external_id": "5006d98a-352f-134f-df6b-33e7f8d5de65", "source" : { "target_display_name" : "sc2-rdops-vm03-dhcp-102-35.eng.vmware.com", "is_valid" : true, "target_type" : "HostNode", "target_id" : "3d0574b8-267c-11e7-9126-0febdf149b8c" }, "type": "REGULAR", "host_id": "74730a28-e52d-11e5-936e-6f061d405a28", "local_id_on_host": "1", "power_state" : "VM_RUNNING", "guest_info": { "os_name": "Ubuntu Linux (64-bit)", "computer_name": "app-vm" }, "_last_sync_time" : 1493291539130 } ] } { "result_count": 1, "results": [ { "resource_type": "VirtualMachine", "display_name": "web-vm", "compute_ids": [ "instanceUuid:50069c43-e024-9fce-6017-001a87ef32be", "moIdOnHost:1", "externalId:50069c43-e024-9fce-6017-001a87ef32be", "hostLocalId:1", "locationId:564d6439-4abb-e39c-1a2f-d2524e3cc3e1", "biosUuid:42060137-3f57-15bb-1bfc-293c4ba89050" ], "external_id": "50069c43-e024-9fce-6017-001a87ef32be", "source" : { "target_display_name" : "sc2-rdops-vm03-dhcp-102-35.eng.vmware.com", "is_valid" : true, "target_type" : "HostNode", "target_id" : "3d0574b8-267c-11e7-9126-0febdf149b8c" }, "type": "REGULAR", "host_id": "65bcd211-e570-11e5-8472-991cc87d670e", "local_id_on_host": "1", "power_state" : "VM_RUNNING", "guest_info": { "os_name": "Ubuntu Linux (64-bit)", "computer_name": "web-vm" }, "_last_sync_time" : 1493291539130 } ] } { "result_count": 1, "results": [ { "resource_type": "VirtualMachine", "display_name": "db-vm-new", "compute_ids": [ "instanceUuid:50314b00-d422-d5d0-0cb2-d8a904a31c16", "moIdOnHost:3", "externalId:50314b00-d422-d5d0-0cb2-d8a904a31c16", "hostLocalId:3", "locationId:564d90f6-8f73-1baa-8226-82d85cc9c5c8", "biosUuid:4231c15f-ca24-b567-65b4-17bf1c0dd20e" ], "external_id": "50314b00-d422-d5d0-0cb2-d8a904a31c16", "source" : { "target_display_name" : "sc2-rdops-vm03-dhcp-102-35.eng.vmware.com", "is_valid" : true, "target_type" : "HostNode", "target_id" : "3d0574b8-267c-11e7-9126-0febdf149b8c" }, "type": "REGULAR", "host_id": "65bcd211-e570-11e5-8472-991cc87d670e", "local_id_on_host": "3", "power_state" : "VM_RUNNING", "guest_info": { "os_name": "Microsoft Windows 10 (64-bit)", "computer_name": "db-vm" }, "_last_sync_time" : 1493291539130 } ] }

Required Permissions:

read

Feature:

vm_vm_info

Additional Errors: