Is there a way to delete all expired maintenance window via API.
I gone through few thread on community and suggestion was to filter on expired maintenance window and delete from UI itself.
But dilemma is, due to huge number of maintenance window the page is not at all loading hence I’m looking to pull all expired MW via API and delete it.
You can use the Dynatrace API to automate the process, but you will need to build the logic into whatever script or job you decide to run to delete them.
So the steps would be:
Get all maintenance windows with the Settings API v2 using the builtin:alerting.maintenance-window schema ID.
For each maintenance window, dive into the body response of the call and check if the scheduleType is ONCE and if the endTime is in the past (we ignore recurring maintenance windows since they are never expired).
It’s a bit complicated, but it’s the only way as the maintenace window doesn’t have an expired field or something else we can check apart from the one mentioned above.
Since there is option to list the expired maintenance window and also, option to delete the expired ones manually in UI, May be candidate for API enhancement instead of the workaround?