VMware Cloud Community
jason_davis
Enthusiast
Enthusiast

vRA Rest API: how to determine if a cancelled (or failed) deployment has been dismissed

I'm building an app using vRA Rest API.  I can dismiss a cancelled deployment with the following API:

/catalog-service/api/consumer/requests/<requestId>/dismiss

I can see this works, because in vRA I see the deployment disappear.

However, I cannot figure out how my own app can know when a cancelled deployment is dismissed.

When calling the following API

/catalog-service/api/consumer/requests

there is no information indicating a cancelled deployment was dismissed.

Any suggestions would be appreciated.

Reply
0 Kudos
5 Replies
eoinbyrne
Expert
Expert

Not quite sure from the posting but do you mean that you want to do

a. List all requests

b. Dismiss a request

c. Confirm that the request was dismissed

Assuming your app can cache the list before cancellation then the absence of the dismissed deployment afterwards should be enough? That is to say if the REST call to dismiss does not report an error then you can treat it as successful if the next listing of deployments does not contain that ID/name?

Reply
0 Kudos
jason_davis
Enthusiast
Enthusiast

eoinbyrne, thanks for the quick reply.

I'm attaching a picture to clarify the issue

cancelled deployment.png

As you can see, here is an example of a cancelled deployment in vRA.  If the user clicks the 'Disimiss' button it will disappear off the screen.

In my application I know how to 'Dismiss' the cancelled deployment via REST API.  But I don't know how to verify it has been dismissed.  Hence in my app, even after sending the Dismiss command, the deployment still appears in my view as Cancelled.

So I am wondering what API I can call to know a given Cancelled or Failed deployment has in fact been dismissed, so that I no longer need to display it to my user.

Reply
0 Kudos
eoinbyrne
Expert
Expert

OK, so you *are* trying to get confirmation that the request Dismiss action was executed by vRA

Looking at the Request data in my vRO inventory (the plugin leverages the REST API as your app does) - any requests I have dismissed are still visible in the Inventory which to me implies that some attribute of the request is changed in order for the Catalog UI to filter it from the view.

The VMware API explorer shows this content for the Request object.

pastedImage_0.png

Looking at the state field, can you check the value there for a dismissed request and see if you can detect a difference for a dismissed request VS one that has not yet been dismissed?

Reply
0 Kudos
jason_davis
Enthusiast
Enthusiast

So we looked at the Request JSON structure before and after dismissing.  Even after a successful dismiss, the state is still CANCELLED.

The only fields that change after the dismiss are:

version  (updated by 1)

lastUpdated

That is hardly enough information for me to deduce the request has been dismissed Smiley Happy

Reply
0 Kudos
xian_
Expert
Expert

Try the catalog resource instead:

dismiss.png

Reply
0 Kudos