Using the vRealize Suite Lifecycle Manager (vRSLCM) API to track vRSLCM Requests

Share this on:

vRealize Suite Lifecycle Manager vRSLCM API

Published on 30 November 2021 by Christopher Lewis. Words: 631. Reading Time: 3 mins.

In this post, we will look at how we can use the VMware vRealize Suite Lifecycle Manager (vRSLCM) API to track the requests we submit either using the API or the UI.

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

Prerequisites

The following prerequisites are required for this blog post:

  • vRSLCM 8.6.x (or above) has been deployed successfully within the environment.
  • vRSLCM local administrator (admin@local) credentials.

Walkthrough

Tracking vRSLCM Requests

Overview

In this section we are going to be looking at what we need to create an API request to track the progress of ALL requests that we have submitted to vRSLCM.

API Request

The following REST API request is required:

  • Request Type: GET
  • Request URL: https://{vrslcm.fqdn}/lcm/request/api/v2/requests
  • 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 --insecure --location --request GET 'https://{vrslcm.fqdn}/lcm/request/api/v2/requests' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {admin@local credential hash}' \

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

API Response

When submitting a successful request (STATUS 200), we should get a list of all the requests in response. Now, I am not going to post the full response here because when I queried my vRLSCM, the response was over 2100 lines of JSON!. Which is not really helpful!

Luckily, if we have the vmid of the request (which is normally provided in the response when creating a request), we can target that specific request and just get the information we need!

Tracking the Progress of a single vRSLCM Request using the vmid

Overview

In this section we are going to be looking at what we need to create an API request to track the progress of a single request that we have submitted to vRSLCM. The most important thing is the vmid and this is typically provided in the response from an API request that creates a vRSLCM request.

API Request

The following REST API request is required:

  • Request Type: GET
  • Request URL: https://{vrslcm.fqdn}/lcm/request/api/v2/requests/{vmid}
  • 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 --insecure --location --request GET 'https://{vrslcm.fqdn}/lcm/request/api/v2/requests/{vmid}' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic {admin@local credential hash}' \

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

API Response

When submitting that API request for a specific vRSLCM Request (in this instance an expansion of the vRLSCM storage), the body of the REST response, should look similar to the following:

{
    "vmid": "0c06429b-358b-4652-aca2-547e3e59ba9f",
    "transactionId": null,
    "requestName": "lcmvadiskexpand",
    "requestReason": "Expand vRSLCM VA Data Disk",
    "requestType": "lcmvadiskexpand",
    "requestSource": null,
    "requestSourceType": "user",
    "inputMap": {
        "diskSizeInGb": "10.0",
        "vcUsername": "{vcenter.username}",
        "vCenterHost": "{vcenter.fqdn}}",
        "vcPassword": "locker:password:{vcenter.password.vmid}:{vcenter.password.alias}"
    },
    "outputMap": {},
    "state": "COMPLETED",
    "executionId": "243e7228-7988-4147-831b-49135151fc87",
    "executionPath": "{value removed due to length of field}",
    "executionStatus": "{value removed due to length of field}",
    "errorCause": null,
    "resultSet": "[]",
    "isCancelEnabled": null,
    "lastUpdatedOn": 1640787524522,
    "createdBy": "admin@local"
}

This is obviously a lot more useful than just 2000 lines of JSON!

The important part of the response is the state field, which will either be INPROGRESS, COMPLETED or FAILED.

Wrapping It All Up!

This is a quick suplimentary post for the vRSLCM API series on how to deploy the vRealize Suite through vRSLCM using only the API. As I was writing the posts in that series, I realised it was important to be able to track the status of requests and more important to be able to track the status of individual request so that we don’t have to log into the UI at all!

Hope this post has been helpful!

Published on 30 November 2021 by Christopher Lewis. Words: 631. Reading Time: 3 mins.