cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

/api/v2/settings/objects and maintenance window - Must be of type local_date_time.

ZiemekBorowski
Frequent Guest

Hello, 

I tried to setup MW as bellow 

[
  {
    "schemaId": "builtin:alerting.maintenance-window",
    "scope": "environment",
    "schemaVersion": "2.14",
    "value": {
      "enabled": true,
      "generalProperties": {
        "name": "Example Window ZZZZ",
        "description": "An example Maintenance window ZZZZ",
        "maintenanceType": "UNPLANNED",
        "suppression": "DETECT_PROBLEMS_DONT_ALERT",
        "disableSyntheticMonitorExecution": false
      },
      "schedule": {
        "scheduleType": "ONCE",
        "onceRecurrence": {
          "startTime": "18:00:00.00",
          "endTime": "19:00:00.00",
          "timeZone": "Europe/Berlin"
        }
      },
      "filters": [
        {
          "entityType": "HOST",
          "entityTags": [
            "PatchGroup:t1g1"
          ],
          "managementZones": [
            "1234567890123455"
          ]
        }
      ]
    }
  }
]

but all call of API finish with warning:

Post to Dynatrace failed.; Error `Create failed with code 400and error: 
{
  "code": 400,
  "message": "Validation failed for 2 Validators.",
  "constraintViolations": [
    {
      "path": "builtin:alerting.maintenance-window/0/schedule/onceRecurrence/startTime",
      "message": "Given property 'startTime' with value: '20:00:00' violates the following constraint: Must be of type local_date_time.",
      "parameterLocation": "PAYLOAD_BODY",
      "location": null
    },
    {
      "path": "builtin:alerting.maintenance-window/0/schedule/onceRecurrence/endTime",
      "message": "Given property 'endTime' with value: '21:00:00' violates the following constraint: Must be of type local_date_time.",
      "parameterLocation": "PAYLOAD_BODY",
      "location": null
    }
  ]
}`

I tested many of format of time and datetime - all wrong. 

Any idea? 

.

1 REPLY 1

ZiemekBorowski
Frequent Guest

OK, I learn that:

local_date_time type follows the following format: year-month-day-hour-minute-second, so for your configuration you will need to adapt the schedule to something like:

       startTime: "2022-08-17T20:00:00" 

Featured Posts