Cancelling Request in vRealize Suite Lifecycle Manager via API

vRLCM is a great tool but the only shortcoming which is still there with v 2.0 is the ability to cancel any running task via GUI. I faced this situation when I was trying to add a remote collector node to an existing vROPS deployment and task kept running for more than 4 hours.

While searching on internet for how we can stop/cancel/delete a request in vRLCM, came across this thread on VMware Code website, where it was mentioned that it’s not possible from GUI and we need to use REST API.

Below steps shows how to use vRLCM API

1: Get Auth token: First of all we need to generate the auth token which we will be using in our next command.

To do so, type https://<vRLCM-FQDN>/api and make sure API v1 is selected as shown below.

Expand the /login section and click on “try it out” button. It will ask you to enter the credentials for admin account. 

Post entering the credentials, hit the execute button.

lcm-api-01

On executing the POST command, auth token is returned in “Response body”. Make a note of the text in quotes after “token”: 

Response body will show the curl command also which can be fired using the curl utility to generate the auth token. You can use this command to do scripting to automate tasks.

lcm-api03

2: Once you have auth token handy, locate the Requests section and expand the /request/status and click on try it out.

Enter the auth token and the request id and hit the execute button.

Note: Request id can be fetched by vRLCM by clicking on task that is stuck. Typically it looks like https://vrlcm-fqdn/vrlcm/requests/status/84c0db582a1a9a755826b7dde3762

lcm-api04

The output of above command clearly shows request state as “INPROGRESS”

lcm-api05

3: Unfortunately the swagger ui don’t have option to delete the request and we have to rely on tools like Curl/Postman etc to do this activity.

I personally like postman and in this post I am gonna use the same. You need following inputs:

Enter the values in respective fields and hit Send button. 

lcm-api06.PNG

If the API call is executed correctly, you will get a “200 OK” status code which means the request has been accepted successfully.  The request status in the vRLCM UI should now as COMPLETED.

lcm-api07.PNG

I hope you enjoyed reading this post. Feel free to share this on social media if it is worth sharing :)

Leave a Reply