Hello again!
Today a customer was working with the vRealize Operations 8.0 REST API in Postman and trying to bulk delete “Canceled Alerts”. The documentation in the API states that you need to request a DELETE against the https://{vra-fqdn}/suite-api/api/alerts/bulk
API and you should be OK. Well, not exactly.
I’ll start this post by assuming that you’ve seen the excellent Postman collection on VMware {code}. This will get you up and running quickly and allow you to login and get an authentication token.
Let’s get started. The customer wants to use the https://{vra-fqdn}/suite-api/api/alerts/bulk
API to bulk delete. Assuming you’ve already logged in, you will need to create a new Request in Postman with the following details:
If it looks familiar, it should. I basically duplicated an existing request in the Postman collection and tweaked it. The {{bearerToken}} variable is just what I use to store the token from the login request. If you ran this now it will fail and Postman will give you a nice message in return:
{
"message": "Invalid input format.",
"moreInformation": [
{
"name": "api-uri",
"value": "/suite-api/api/alerts/bulk"
}
],
"httpStatusCode": 400,
"apiErrorCode": 400
}
Looking over the documentation, you’ll note that the request does not need any parameters, but it does require a body of type ns3:alert-query
. The ns:3alert-query
type is simply a list of optional filters that we can use to find alerts so that vRealize Operations can delete them.
The API docs aren’t exactly clear on what it should look like, only what it can contain. As we only want to filter on “Canceled” alerts, there is an alert status property of type ns3:alert-status
that we can include in our body. It’s in this alert status that we’ll specify “CANCELED”.
How does it look if that is all we need? Here’s the JSON to include in the body:
{
"alert-query": {
"alertStatus": {
"alertStatus": "CANCELED"
}
}
}
Your request in Postman should look like this:
If you would like me to expand on this a bit more, let me know. Happy to update the post.
- Restore of a Wordpress deployment is stuck redirecting the port
- Backups and Restores using Velero in TKGm 1.6.1
- Unable to upgrade the database: org.postgresql.util.PSQLException: ERROR: could not open shared memory segment: No such file or directory
- Upgrading Cloud Director 10.4.1 to 10.5
- Installing and Configuring Velero in TKGm 1.6.1 on vSphere