Using the vRealize Suite Lifecycle Manager (vRSLCM) API for vRSLCM Day 2 Operations - Downloading Products from My VMware

Share this on:

vRealize Suite Lifecycle Manager vRSLCM API

Published on 3 December 2021 by Christopher Lewis. Words: 1590. Reading Time: 8 mins.

In this post, we will look at how we can use the VMware vRealize Suite Lifecycle Manager (vRSLCM) API to complete Day 2 Operations in vRSLCM to manage access to our My VMware account so we can access licenses, download Products Binaries and consume Marketplace content.

We are going to be using cURL to complete API calls to complete the following operation tasks around managing the access to My VMware:

  • Adding My VMware Account Credentials
  • Get All Available Product Binaries from My VMware
  • Get All Supported Versions of a Product
  • Downloading Product Binaries
  • Downloading Product Licenses

This post is a part of a series that covers how we can install, configure and manage the vRealize Suite using the vRSLCM API.

Prerequisites

The following prerequisites are required for this blog post:

Walkthrough

Adding My VMware Account Credentials

Overview

In this section we are going to be looking at the API call we need to add a My VMware account into vRSLCM.

API Request

The following REST API request is required:

  • Request Type: POST
  • Request URL: https://{vrslcm.fqdn}/lcm/lcops/api/v2/settings/my-vmware/accounts
  • Request Header(s):
    • Accept: application/json
    • Content-Type: application/json
    • Authorization: Basic {admin@local credential hash}
  • Request Body Values:
    • None

API Example

An example cURL command for this REST API is:

curl --location --request POST 'https://{vrslcm.fqdn}/lcm/lcops/api/v2/settings/my-vmware/accounts' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {admin@local credential hash}' \
--data-raw '{
  "password": "locker:password:{myvmware.password.vmid}:{myvmware.password.alias}",
  "userName": "{myvmware.username}"
}'

Note: Remember, the –insecure flag is also required if you are using self-signed SSL certificates.

API Response

When submitting a successful request (Status Code = 200 OK), you should receive a response that shows the account information you have submitted:

{
  "password": "locker:password:{myvmware.password.vmid}:{myvmware.password.alias}",
  "userName": "{myvmware.username}"
}

If we now logged into vRSLCM using the UI (and navigate to Lifecycle Operations > Settings > My VMware), we would now see:

So now we have a My VMware account configured let see if we can download some Products Binaries… but first we need to identiy which versions of products are supported!

Get All Available Product Binaries from My VMware

Overview

In this section we are going to be looking at the API call we can use to retrieve all of the available Product Bianries for download from My VMware. We need this information, along with the supported Product Versions (see next the next section) to identify the content required for the REST API calls to actually download the Product Binaries. Obviously, once you have all the information we can re-use it as often as we like and only have to check again once new versions of products have been released.

API Request

The following REST API request is required:

  • Request Type: POST
  • Request URL: https://{vrslcm.fqdn}/lcm/lcops/api/v2/settings/my-vmware/product-binaries
  • Request Header(s):
    • Accept: application/json
    • Content-Type: application/json
    • Authorization: Basic {admin@local credential hash}
  • Request Body Values:
    • None

API Example

An example cURL command for this REST API is:

curl --location --request POST 'https://{vrslcm.fqdn}/lcm/lcops/api/v2/settings/my-vmware/product-binaries' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {admin@local credential hash}'

Note: Remember, the –insecure flag is also required if you are using self-signed SSL certificates.

API Response

When submitting a successful request (Status Code = 200 OK), you should receive a response that shows a list of all Product Binaries available from My VMware. For the purpose of this post I have just supplied a small sample of the 200+ lines of JSON as an example:

[
    {
        "productId": "vidm",
        "productVersion": "3.4.0",
        "productBinaryType": "install",
        "productBinaryPath": null,
        "componentName": null,
        "mappingType": null,
        "productName": "VMware Identity Manager",
        "requestId": null,
        "removeBinary": null
    },
    {
        "productId": "vidm",
        "productVersion": "3.3.5",
        "productBinaryType": "upgrade",
        "productBinaryPath": null,
        "componentName": null,
        "mappingType": null,
        "productName": "VMware Identity Manager",
        "requestId": null,
        "removeBinary": null
    },
    {
        "productId": "vidm",
        "productVersion": "3.3.5",
        "productBinaryType": "Install",
        "productBinaryPath": null,
        "componentName": null,
        "mappingType": null,
        "productName": "VMware Identity Manager",
        "requestId": null,
        "removeBinary": null
    }
]

We will use the information in the response provided above in two ways:

  1. The productId of each product which is required to check the versions supported in vRSLCM.
  2. All of the information on a specific Product can be used int he REST API request to download the binaries.

Get All Supported Versions of a Product

Overview

In this section we are going to be using an request to the vRSLCM Product Policy Controller API to retrieve the supported versions of products in the current version of vRSLCM. Why do we need that information? Well, the Product Version is required to be able to download the right Product Binaries from My VMware. As an example, we may want a particular version, but it may not be supported in the current version of vRSLCMs Product Support Pack (PSP).

POST API Request

The following REST API request is required:

  • Request Type: GET
  • Request URL: https://{vrslcm.fqdn}/lcm/lcops/api/v2/products/{productId}/versions
    • productId - Is one of the following values:
    • vra - vRealize Automation
    • vrops - vRealize Operations
    • vrli - vRealize Log Insight
    • vrni - vRealize Network Insight
    • vidm - VMware Identity Manager
  • Request Header(s):
    • Accept: application/json
    • Content-Type: application/json
    • Authorization: Basic {insert credential hash}
  • Request Body Values:
    • None

API Example

An example cURL command for this REST API is:

curl --location --request GET 'https://{vrslcm.fqdn}/lcm/lcops/api/v2/products/vidm/versions' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {admin@local credential hash}'

Note: The –insecure flag is also required if you are using self-signed SSL certificates.

API Response

The expected response for a successful API call (when getting supported vIDM product versions) is:

[
    "3.3.5"
]

So now we know what versions of a particular product is supported, we can download the correct Product Binary from My VMware.

Downloading Product Binaries

Overview

In this section we are going to be using an API request to download the Product Binaries from My VMware to the vRSLCM appliance. We are going to be using VMware Identity Manager in this example but it the API call will work for any of the products supported.

POST API Request

The following REST API request is required:

  • Request Type: POST
  • Request URL: https://{vrslcm.fqdn}/lcm/lcops/api/v2/settings/my-vmware/product-binaries/download
  • Request Header(s):
    • Accept: application/json
    • Content-Type: application/json
    • Authorization: Basic {insert credential hash}
  • Request Body Values:
    • productId - The ID (or shortcode) for the specific product which can be obtained through the section Get All Available Product Binaries from My VMware.
    • producName - The Name for the specific product which can be obtained through the section Get All Available Product Binaries from My VMware.
    • productVersion - The supported Version of the product which can be obtained through the section Get All Supported Versions of a Product above.
    • productBinaryType - The Binary Type, either Install or Upgrade.
    • productBinaryPath - This should be set to null when downloading from My VMware.
    • componentName - This should be set to null when downloading from My VMware.
    • mappingType - This should be set to null when downloading from My VMware.
    • requestId - This should be set to null as it is generated as part of the API request.
    • removeBinary - This should be set to null when downloading from My VMware.

API Example

An example cURL command for this REST API is:

curl --location --request POST 'https://{vrslcm.fqdn}/lcm/lcops/api/v2/settings/my-vmware/product-binaries/download' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {admin@local credential hash}' \
--data-raw '[
    {
    "productId": "vidm",
    "productVersion": "3.3.5",
    "productBinaryType": "Install",
    "productBinaryPath": null,
    "componentName": null,
    "mappingType": null,
    "productName": "VMware Identity Manager",
    "requestId": null,
    "removeBinary": null
    }
]'

Note: The –insecure flag is also required if you are using self-signed SSL certificates.

API Response

When submitting that request, a request is created and the API response should be a request ID for you to track. Something similar to:

{
    "requestId": "68ad91d7-8df5-4316-8a05-46d0875437db"
}

Remeber we can track the progress of requests via the API too! Check out Using the vRealize Suite Lifecycle Manager (vRSLCM) API to track vRSLCM Requests for more information!

Once the request is completed, if we logged into the vRSLCM appliance (and navigate to Lifecycle Operations > Settings > Binary Mapping) we will see the that the install OVA for vIDM has been downloaded.

Downloading Product Licensing

Overview

In this section we are going to be using an API request to download the Product Licenses from My VMware to the vRSLCM appliance.

POST API Request

The following REST API request is required:

  • Request Type: GET
  • Request URL: https://{vrslcm.fqdn}/lcm/locker/api/v2/licenses/refresh
  • Request Header(s):
    • Accept: application/json
    • Content-Type: application/json
    • Authorization: Basic {insert credential hash}
  • Request Body Values:
    • None.

API Example

An example cURL command for this REST API is:

curl --location --request GET 'https://{vrslcm.fqdn}/lcm/locker/api/v2/licenses/refresh' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {admin@local credential hash}'

Note: The –insecure flag is also required if you are using self-signed SSL certificates.

API Response

When submitting that request the response will be an acknowledgement:

{
    "vmid": "57f237df-69e8-492e-a5b4-e9fe93322b82",
    "action": "REFRESH_LICENSES",
    "message": "Refresh License from myvmware triggered successfully"
}

Once the vRSLCM request has completed successfully, if we logged into the vRSLCM appliance (and navigate to Locker > Licenses) we will see the licenses have been downloaded.

Wrapping It All Up!

In this post we have started to explore the way we can complete Day 2 Operations that manage different aspects of vRSLCM via the API. We looked at how, using an API, we can configure vRSLCM to be able to access to the My VMware portal, download product binaries and download product licenses.

If this API this snippet has been helpful, make sure you checkout the rest of the series!

Published on 3 December 2021 by Christopher Lewis. Words: 1590. Reading Time: 8 mins.