VMware Cloud Community
ajruckman0
Contributor
Contributor

How to get VM's instanceUUID using vSphere REST API?

Articles like these tell me that I should uniquely identify VMs and other objects in vSphere by their InstanceUUID + MoRef ID:

https://blogs.vmware.com/vsphere/2012/02/uniquely-identifying-virtual-machines-in-vsphere-and-vcloud...
https://blogs.vmware.com/vsphere/2012/02/uniquely-identifying-virtual-machines-in-vsphere-and-vcloud...
https://www.virtuallyghetto.com/2017/07/uniquely-identifying-vms-in-vsphere-part-3-enhanced-linked-m...

But I can't find a way to get instance UUIDs using the API. The "https://[vSphere hostname]/rest/vcenter/vm/vm-1234" endpoint does not return it.

How can I get the instance UUID from the REST API?

0 Kudos
3 Replies
djerfe
Contributor
Contributor

We also have a use case for pulling this information from the REST API - as mentioned in the post above mine, we too use the InstanceUUID as a "serial number" of sorts to uniquely identify VM instances and track them as they move across environments.

Currently we pull this information via other API methods and either insert it directly into databases for consumption, or generate a file for bulk import - this works, but it's a bit clunky. Several of the 3rd-party platforms we integrate with do have native support for REST/JSON data, which I think would be a cleaner option if this information were available.

Is anyone from VMware aware of any plans for expanded support for VM data, specifically InstanceUUID, via REST API? Searching through the forums I've stumbled across this request a few times, but the latest updates are from a couple years ago.

Thanks!

0 Kudos
doskiran
Enthusiast
Enthusiast

Use REST API - GET : https://{vcenter}/api/vcenter/vm/{vm}

Response:

....

"identity": {

                  "bios_uuid": "string",

                  "instance_uuid": "string",

                  "name": "string"

               },

....

 

 

0 Kudos
cookie2
Contributor
Contributor

Hi, I also want to retrieve the VM UUID from API.

 

Does「{vm}」means "vm name"?

I tried to put the GET request as you suggested, but it didn't work well.

I tried this request: https://{vcenter-IP-address}/api/vcenter/vm/{vm-name}

Also that would be helpful if you could tell me the documents or something URL that is mentioned regarding this how to get VM UUID info from API.

Thank you

0 Kudos