Migrate from Maintenance windows API to Settings API
The Maintenance windows API has been deprecated with Dynatrace version 1.240. Its replacement is Settings API with the Maintenance windows (builtin:alerting.maintenance-window
) schema. We recommend that you migrate to the new API at your earliest convenience.
The migration affects endpoint URLs, query parameters, and response/request body parameters, as well as the scope of the token for request authentication.
Base URL
new Settings 2.0 | old Maintenance windows |
---|---|
/api/v2/settings | /api/config/v1/maintenanceWindows |
Authentication token scope
new Settings 2.0 | old Maintenance windows |
---|---|
Read settings (settings.read )Write settings ( settings.write ) | Read configuration (ReadConfig )Write configuration ( WriteConfig ) |
Parameters
To learn about new query/body parameters, see the documentation of individual requests in Settings API.
In the Settings 2.0 framework, each maintenance window is represented by a settings object. An object contains some metadata (like the scope or creation timestamp) and the configuration itself, encapsulated in the value object. To learn about the parameters of the maintenance window configuration, query the Maintenance windows (builtin:alerting.maintenance-window
) schema with the GET a schema request.
Examples
Here are some examples of differences in API usage.
List maintenance windows
To list all maintenance windows, you need the GET objects request. In query parameters, set schemaIds to builtin:alerting.maintenance-window
and scope to environment
.
Request URL
1GET https://mySampleEnv.live.dynatrace.com/api/v2/settings/objects?schemaIds=builtin:alerting.maintenance-window&scopes=environment
Response body
1{2 "items": [3 {4 "objectId":5 "vu9U3hXa3q0AAAABACNidWlsdGluOmFsZXJ0aW5nLm1haW50ZW5hbmNlLXdpbmRvdwAGdGVuYW50AAZ0ZW5hbnQAJDgwMzdjNWM3LTdkNTgtNGQyYy04YzJkLWViMTYxMTBkZTE2Mr7vVN4V2t6t",6 "value": {7 "enabled": true,8 "generalProperties": {9 "name": "Synthetic scaling",10 "description": "Maintenance window for adaptations of Synthetic monitors",11 "maintenanceType": "PLANNED",12 "suppression": "DETECT_PROBLEMS_DONT_ALERT",13 "disableSyntheticMonitorExecution": false14 },15 "schedule": {16 "scheduleType": "ONCE",17 "onceRecurrence": {18 "startTime": "2022-12-22T09:00:00",19 "endTime": "2022-12-22T12:00:00",20 "timeZone": "UTC"21 }22 },23 "filters": [24 {25 "entityType": "HOST",26 "entityTags": [27 "[AWS]Usage:Synthetic"28 ],29 "managementZones": []30 }31 ]32 }33 },34 {35 "objectId": "vu9U3hXa3q0AAAABACNidWlsdGluOmFsZXJ0aW5nLm1haW50ZW5hbmNlLXdpbmRvdwAGdGVuYW50AAZ0ZW5hbnQAJDE3NDgxMWYxLWQ2NjYtNGJhNy1iZmU3LTk5ZGYzMjIyNjY3Mr7vVN4V2t6t",36 "value": {37 "enabled": true,38 "generalProperties": {39 "name": "Issue with pre-production environment",40 "maintenanceType": "UNPLANNED",41 "suppression": "DONT_DETECT_PROBLEMS",42 "disableSyntheticMonitorExecution": false43 },44 "schedule": {45 "scheduleType": "ONCE",46 "onceRecurrence": {47 "startTime": "2022-12-10T10:00:00",48 "endTime": "2022-12-10T14:00:00",49 "timeZone": "Europe/Vienna"50 }51 },52 "filters": [53 {54 "entityType": "SERVICE",55 "entityTags": [56 "Env-pre-prod"57 ],58 "managementZones": []59 },60 {61 "entityType": "PROCESS_GROUP",62 "entityTags": [63 "Env-pre-prod"64 ],65 "managementZones": []66 }67 ]68 }69 }70 ],71 "totalCount": 2,72 "pageSize": 100,73}
Create a maintenance window
To create a maintenance window, you need the POST an object request. In the request body, set schemaId to builtin:alerting.maintenance-window
and scope to environment
. Provide the maintenance window configuration in the value object.
The response contains the ID of the object that you need to modify the settings.
Request URL
1POST https://mySampleEnv.live.dynatrace.com/api/v2/settings/objects
Request body
1[2 {3 "schemaId": "builtin:alerting.maintenance-window",4 "scope": "environment",5 "value": {6 "enabled": true,7 "generalProperties": {8 "name": "Sample maintenance window",9 "maintenanceType": "PLANNED",10 "suppression": "DETECT_PROBLEMS_AND_ALERT",11 "disableSyntheticMonitorExecution": false12 },13 "schedule": {14 "scheduleType": "MONTHLY",15 "monthlyRecurrence": {16 "dayOfMonth": 1,17 "timeWindow": {18 "startTime": "06:00:00",19 "endTime": "06:30:00",20 "timeZone": "Europe/Vienna"21 },22 "recurrenceRange": {23 "scheduleStartDate": "2022-01-01",24 "scheduleEndDate": "2022-12-31"25 }26 }27 },28 "filters": [29 {30 "entityType": "SERVICE",31 "entityTags": [32 "stage:pre-production"33 ],34 "managementZones": []35 }36 ]37 }38 }39]
Response body
1[2 {3 "code": 200,4 "objectId": "vu9U3hXa3q0AAAABACNidWlsdGluOmFsZXJ0aW5nLm1haW50ZW5hbmNlLXdpbmRvdwAGdGVuYW50AAZ0ZW5hbnQAJDVhMjg2NmE5LTJjZjQtMzIwZC1hNjMxLTI0NTAwYTQ4NmU5Zr7vVN4V2t6t"5 }6]
Edit a maintenance window
To edit a maintenance window, you need the PUT an object request.
Request URL
1PUT https://mySampleEnv.live.dynatrace.com/api/v2/settings/objects/vu9U3hXa3q0AAAABABhidWlsdGluOmFsZXJ0aW5nLnByb2ZpbGUABnRlbmFudAAGdGVuYW50ACQzYjAwNDMwOC01ZTZjLTNkNGMtOTNjMS01ZTBiOWRhZTlhZjW-71TeFdrerQ
Request body
1{2 "schemaId": "builtin:alerting.maintenance-window",3 "scope": "environment",4 "value": {5 "enabled": true,6 "generalProperties": {7 "name": "Sample maintenance window",8 "maintenanceType": "PLANNED",9 "suppression": "DETECT_PROBLEMS_AND_ALERT",10 "disableSyntheticMonitorExecution": false11 },12 "schedule": {13 "scheduleType": "MONTHLY",14 "monthlyRecurrence": {15 "dayOfMonth": 5,16 "timeWindow": {17 "startTime": "01:00:00",18 "endTime": "01:30:00",19 "timeZone": "Europe/Vienna"20 },21 "recurrenceRange": {22 "scheduleStartDate": "2022-01-01",23 "scheduleEndDate": "2022-12-31"24 }25 }26 },27 "filters": [28 {29 "entityType": "SERVICE",30 "entityTags": [31 "stage:pre-production"32 ],33 "managementZones": [34 "5561909168316319665"35 ]36 }37 ]38 }39 }
Response body
1[2 {3 "code": 200,4 "objectId": "vu9U3hXa3q0AAAABABhidWlsdGluOmFsZXJ0aW5nLnByb2ZpbGUABnRlbmFudAAGdGVuYW50ACQzYjAwNDMwOC01ZTZjLTNkNGMtOTNjMS01ZTBiOWRhZTlhZjW-71TeFdrerQ"5 }6]