Get the UUID of the virtual machine in VC from vROPS

The ID of the virtual machine object in vROPS is resourceID, which is inconsistent with the UUID of the virtual machine in vCenter. Therefore, if you want to match the virtual machine in vROPS with the virtual machine in vCenter, you must not rely on the virtual machine name, but must rely on the UUID. .

The following example shows how to get the UUID of a virtual machine in vCenter through the vROPS API

Step 1, obtain vROPS Token

URL: https://vrops.vmware.com/suite-api/api/auth/token/acquire<br>Method: POST<br>Content-Type: application/json<br>Accept: application/json<br>Body: {"username":"admin","password":"VMware1!"}<br>Response:
{
    "token": "4971b55f-68aa-47a0-a351-19fa751d59cb::5c1db8e3-90ec-44f4-87f7-ad986f358ca6",
    "validity": 1556219805813,
    "expiresAt": "Friday, April 26, 2019 3:16:45 AM CST",
    "roles": []
}

Step 2, obtain the virtual machine UUID

URL: https://vrops.dev-pso.com/suite-api/api/resources?name=000-001-OS-P003<br>Method: GET<br>Authorization: vRealizeOpsToken {<!-- -->{token}}<br>Accept: application/json<br>Response:
{
    "pageInfo": {
        "totalCount": 1,
        "page": 0,
        "pageSize": 1000
    },
    "links": [
        {
            "href": "/suite-api/api/resources?name=000-001-OS-P003 & amp;amp;page=0 & amp;amp;pageSize=1000",
            "rel": "SELF",
            "name": "current"
        },
        {
            "href": "/suite-api/api/resources?name=000-001-OS-P003 & amp;amp;page=0 & amp;amp;pageSize=1000",
            "rel": "RELATED",
            "name": "first"
        },
        {
            "href": "/suite-api/api/resources?name=000-001-OS-P003 & amp;amp;page=0 & amp;amp;pageSize=1000",
            "rel": "RELATED",
            "name": "last"
        }
    ],
    "resourceList": [
        {
            "creationTime": 1555486851466,
            "resourceKey": {
                "name": "000-001-OS-P003",
                "adapterKindKey": "VMWARE",
                "resourceKindKey": "VirtualMachine",
                "resourceIdentifiers": [
                    {
                        "identifierType": {
                            "name": "VMEntityInstanceUUID",
                            "dataType": "STRING",
                            "isPartOfUniqueness": false
                        },
                        <strong>"value": "50229f5c-74e6-9e0a-c3f4-a1d104e6fbe9" // vmUUID, is consistent with the virtualMachine.ConfigInfo.instanceUUID of the VM in VC</strong>
                    },
                    {
                        "identifierType": {
                            "name": "VMEntityName",
                            "dataType": "STRING",
                            "isPartOfUniqueness": false
                        },
                        "value": "000-001-OS-P003"
                    },
                    {
                        "identifierType": {
                            "name": "VMEntityObjectID",
                            "dataType": "STRING",
                            "isPartOfUniqueness": true
                        },
                        "value": "vm-601"
                    },
                    {
                        "identifierType": {
                            "name": "VMEntityVCID",
                            "dataType": "STRING",
                            "isPartOfUniqueness": true
                        },
                        "value": "e55e5bf7-06f7-4a77-9fb5-d16bcc4d5ecc"
                    }
                ]
            },
            "resourceStatusStates": [
                {
                    "adapterInstanceId": "e9e24f83-a735-4e8c-a974-0d01a2d9d681",
                    "resourceStatus": "DATA_RECEIVING",
                    "resourceState": "STARTED",
                    "statusMessage": ""
                }
            ],
            "resourceHealth": "RED",
            "resourceHealthValue": 25,
            "dtEnabled": true,
            "badges": [
                {
                    "type": "HEALTH",
                    "color": "RED",
                    "score": 25
                },
                {
                    "type": "CAPACITY_REMAINING",
                    "color": "GREEN",
                    "score": 66.13910915503129
                },
                {
                    "type": "COMPLIANCE",
                    "color": "GREY",
                    "score": -1
                },
                {
                    "type": "TIME_REMAINING",
                    "color": "GREEN",
                    "score": 366
                },
                {
                    "type": "RISK",
                    "color": "GREEN",
                    "score": 0
                },
                {
                    "type": "EFFICIENCY",
                    "color": "GREEN",
                    "score": 100
                },
                {
                    "type": "WORKLOAD",
                    "color": "GREEN",
                    "score": 33.4913158416748
                }
            ],
            "relatedResources": [],
            "links": [
                {
                    "href": "/suite-api/api/resources/40394dc8-2828-4277-85ef-15727e9c0e93",
                    "rel": "SELF",
                    "name": "linkToSelf"
                },
                {
                    "href": "/suite-api/api/resources/40394dc8-2828-4277-85ef-15727e9c0e93/relationships",
                    "rel": "RELATED",
                    "name": "relationsOfResource"
                },
                {
                    "href": "/suite-api/api/resources/40394dc8-2828-4277-85ef-15727e9c0e93/properties",
                    "rel": "RELATED",
                    "name": "propertiesOfResource"
                },
                {
                    "href": "/suite-api/api/alerts?resourceId=40394dc8-2828-4277-85ef-15727e9c0e93",
                    "rel": "RELATED",
                    "name": "alertsOfResource"
                },
                {
                    "href": "/suite-api/api/symptoms?resourceId=40394dc8-2828-4277-85ef-15727e9c0e93",
                    "rel": "RELATED",
                    "name": "symptomsOfResource"
                },
                {
                    "href": "/suite-api/api/resources/40394dc8-2828-4277-85ef-15727e9c0e93/statkeys",
                    "rel": "RELATED",
                    "name": "statKeysOfResource"
                },
                {
                    "href": "/suite-api/api/resources/40394dc8-2828-4277-85ef-15727e9c0e93/stats/latest",
                    "rel": "RELATED",
                    "name": "latestStatsOfResource"
                },
                {
                    "href": "/suite-api/api/resources/40394dc8-2828-4277-85ef-15727e9c0e93/properties",
                    "rel": "RELATED",
                    "name": "latestPropertiesOfResource"
                },
                {
                    "href": "/suite-api/api/credentials/",
                    "rel": "RELATED",
                    "name": "credentialsOfResource"
                }
            ],
            "identifier": "40394dc8-2828-4277-85ef-15727e9c0e93"
        }
    ]
}