<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Creating maintenance window using setting API in Alerting</title>
    <link>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/226735#M3825</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried to use this code to create a MW from Servicenow via REST and I am getting the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*** Script: {"error":{"code":400,"message":"Could not map JSON at '' near line 1 column 1"}}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var rm = new sn_ws.RESTMessageV2(); 
var jsonObj =   {
  "scope":"environment",
  "schemaId":"builtin:alerting.maintenance-window",
  "schemaVersion":"2.14.2",
  "value":{
     "enabled":true,
     "generalProperties":{
        "name":"TEST INTEGRATION",
        "description":"This a test for maintenance window via API",
        "maintenanceType":"PLANNED",
        "suppression":"DONT_DETECT_PROBLEMS",
        "disableSyntheticMonitorExecution":true
     },
     "schedule":{
        "scheduleType":"ONCE",
        "onceRecurrence":{
           "startTime":"2023-12-29T13:45:00",
           "endTime":"2023-12-30T14:45:00",
           "timeZone":"Europe/Vienna"
        }
     },
     "filters":[
        
     ]
  }
};
rm.setEndpoint('https://{environmentid}.live.dynatrace.com/api/v2/settings/objects'); 
rm.setHttpMethod('POST'); 
rm.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
rm.setRequestHeader('entities.write', 'application/json;charset=UTF-8');
rm.setRequestHeader('Accept', 'application/json; charset=utf-8');
rm.setRequestHeader('Authorization', 'Api-Token dt0c01.......');
rm.setRequestBody(JSON.stringify(jsonObj));


var response = rm.execute();
var responseBody = response.getBody(); 

gs.print(responseBody);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I dont understand why this is not being able to parse the JSON.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Gabriel&lt;/P&gt;</description>
    <pubDate>Thu, 26 Oct 2023 13:35:01 GMT</pubDate>
    <dc:creator>gabrielsantos</dc:creator>
    <dc:date>2023-10-26T13:35:01Z</dc:date>
    <item>
      <title>Creating maintenance window using setting API</title>
      <link>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/213055#M3530</link>
      <description>&lt;P&gt;&lt;FONT face="terminal,monaco" size="2"&gt;Hi,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="terminal,monaco" size="2"&gt;I am trying to create a maintenance window using settings API, but getting an error, could anyone please help?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="terminal,monaco" size="2"&gt;&lt;STRONG&gt;Body:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;[
  {
    "schemaId": "builtin:alerting.maintenance-window",
    "displayName": "Maintenance windows",
    "description": "Maintenance windows are typically planned, recurring periods of system downtime during which your DevOps team can perform preventative maintenance and system upgrades outside of peak traffic hours.",
    "scope": "environment",
    "value": {
      "enabled": true,
      "generalProperties": {
        "name": "Example Window",
        "description": "An example Maintenance window",
        "maintenanceType": "UNPLANNED",
        "suppression": "DONT_DETECT_PROBLEMS",
        "disableSyntheticMonitorExecution": true
      },
      "schedule": {
        "scheduleType": "ONCE",
        "OnceRecurrence": {
            "startTime": "13:45:00",
            "endTime": "14:45:00",
            "timeZone": "Europe/Vienna"
        }
      }
    }
  }
]&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;&lt;FONT face="terminal,monaco" size="2"&gt;&lt;STRONG&gt;Error:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;"code": 400,
"error": {
    "code": 400,
    "message": "Validation failed for 2 Validators.",
    "constraintViolations": [
        {
            "path": "builtin:alerting.maintenance-window/0/schedule/onceRecurrence",
            "message": "Given property 'onceRecurrence' with value: 'null' does not comply with required NonNull of schema",
            "parameterLocation": "PAYLOAD_BODY",
            "location": null
        },
        {
            "path": "builtin:alerting.maintenance-window/0/schedule/OnceRecurrence",
            "message": "Given property 'OnceRecurrence' with value: '{startTime=13:45:00, endTime=14:45:00, timeZone=Europe/Vienna}' was not found in the schema",
            "parameterLocation": "PAYLOAD_BODY",
            "location": null
        }
    ]
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2023 13:35:28 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/213055#M3530</guid>
      <dc:creator>Naveen</dc:creator>
      <dc:date>2023-05-29T13:35:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to create maintenance window using setting API?</title>
      <link>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/213060#M3531</link>
      <description>&lt;P&gt;You can generate a sample payload by creating a maintenance window in the console and using the API option under the "..." button in the upper right corner of the maintenance window configuration.&amp;nbsp; Open the "Add as new value" section and copy the result, which has the JSON payload as part of the curl command.&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I dumped the JSON for one of my maintenance windows, the onceRecurrence looked like this:&lt;BR /&gt;&lt;BR /&gt;"onceRecurrence": {&lt;BR /&gt;"startTime": "2020-09-26T22:50:00",&lt;BR /&gt;"endTime": "2020-09-27T00:00:00",&lt;BR /&gt;"timeZone": "America/Los_Angeles"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;You're missing the date in your start and end times.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="mgome_0-1684946866119.png" style="width: 400px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/11852iF795A7920364A0FB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="mgome_0-1684946866119.png" alt="mgome_0-1684946866119.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The local_date_time is of type&amp;nbsp;&lt;SPAN&gt;java.time.LocalDateTime&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://docs.oracle.com/javase/8/docs/api/java/time/LocalDateTime.html" target="_blank"&gt;https://docs.oracle.com/javase/8/docs/api/java/time/LocalDateTime.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2023 16:49:47 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/213060#M3531</guid>
      <dc:creator>mgome</dc:creator>
      <dc:date>2023-05-24T16:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to create maintenance window using setting API?</title>
      <link>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/213067#M3534</link>
      <description>&lt;P&gt;I highly recommend making one via the UI, then do an API pull to grab the json for that Maintenance Window. Then once you do that you can break it down and templatize the MW. That's how we did it and inserted that Json into the CICD Pipeline.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 May 2023 17:22:44 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/213067#M3534</guid>
      <dc:creator>ChadTurner</dc:creator>
      <dc:date>2023-05-24T17:22:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to create maintenance window using setting API?</title>
      <link>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/213149#M3537</link>
      <description>&lt;P&gt;&lt;FONT face="terminal,monaco" size="2"&gt;Thanks&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/14877"&gt;@ChadTurner&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/8132"&gt;@mgome&lt;/a&gt;&amp;nbsp;I have tried the method suggested by you but getting below error in the request&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="terminal,monaco" size="2"&gt;I am using powershell to get time and invoking API.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Invoke-RestMethod : [{"code":400,"error":{"code":400,"message":"Validation failed for 6 Validators.","constraintViolations":[{"
path":"builtin:alerting.maintenance-window/0/schedule/onceRecurrence/startTime","message":"Given property 'startTime' with 
value: '2023-05-25 11.35.09' 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: '2023-05-25 12.35.09' violates the following constraint: Must be of type local_date_time.","para
meterLocation":"PAYLOAD_BODY","location":null},{"path":"builtin:alerting.maintenance-window/0/generalProperties/disableSyntheti
cMonitorExecution","message":"Given property 'disableSyntheticMonitorExecution' with value: 'true' violates the following 
constraint: Must be of type boolean.","parameterLocation":"PAYLOAD_BODY","location":null},{"path":"builtin:alerting.maintenance
-window/0/filters/0/entityId","message":"Given property 'entityId' with value: 'null' violates the following constraint: 
Please use a format of TYPE-ID.","parameterLocation":"PAYLOAD_BODY","location":null},{"path":"builtin:alerting.maintenance-wind
ow/0/filters/0/entityId","message":"Given property 'entityId' with value: 'null' violates the following constraint: Invalid 
entity id..","parameterLocation":"PAYLOAD_BODY","location":null},{"path":"builtin:alerting.maintenance-window/0/enabled","messa&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="terminal,monaco" size="2"&gt;Could you please help, I have tried putting up different time format like&amp;nbsp;2023-05-25T15.30.54 or&amp;nbsp;1685009069&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2023 13:43:20 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/213149#M3537</guid>
      <dc:creator>Naveen</dc:creator>
      <dc:date>2023-05-25T13:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to create maintenance window using setting API?</title>
      <link>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/213162#M3538</link>
      <description>&lt;P&gt;&lt;FONT face="terminal,monaco" size="2"&gt;Thanks&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/14877"&gt;@ChadTurner&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/8132"&gt;@mgome&lt;/a&gt;&amp;nbsp;I have tried posting it using the powershell but unable to format the starttime and endtime, could you please let me know what time format is it.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="terminal,monaco" size="2"&gt;I have tried&amp;nbsp;([DateTimeOffset]$localTime).ToUnixTimeSeconds() or&amp;nbsp;$localTime.ToString("yyyy-MM-ddTHH:mm:ss") but it's throwing an error.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2023 15:28:23 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/213162#M3538</guid>
      <dc:creator>Naveen</dc:creator>
      <dc:date>2023-05-25T15:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to create maintenance window using setting API?</title>
      <link>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/213166#M3539</link>
      <description>&lt;P&gt;The proper key is "&lt;SPAN&gt;onceRecurrence&lt;/SPAN&gt;". You have "O&lt;SPAN&gt;nceRecurrence" with a capital "O" in your payload.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2023 16:03:17 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/213166#M3539</guid>
      <dc:creator>mgome</dc:creator>
      <dc:date>2023-05-25T16:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to create maintenance window using setting API?</title>
      <link>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/213231#M3541</link>
      <description>&lt;P&gt;&lt;FONT face="terminal,monaco" size="2"&gt;Hey&amp;nbsp;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/8132"&gt;@mgome&lt;/a&gt;&amp;nbsp;still the same error&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="terminal,monaco" size="2"&gt;&lt;STRONG&gt;Invoke-RestMethod : [{"code":400,"error":{"code":400,"message":"Validation failed for 6 &lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="terminal,monaco" size="2"&gt;&lt;STRONG&gt;Validators.","constraintViolations":[{"path":"builtin:alerting.maintenance-window/0/schedule/onceRecurrence","message":"Given &lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="terminal,monaco" size="2"&gt;&lt;STRONG&gt;property 'onceRecurrence' with value: 'null' does not comply with required NonNull of schema","parameterLocation":"PAYLOAD_BODY&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="terminal,monaco" size="2"&gt;&lt;STRONG&gt;","location":null},{"path":"builtin:alerting.maintenance-window/0/schedule/OnceRecurrence","message":"Given property &lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="terminal,monaco" size="2"&gt;&lt;STRONG&gt;'OnceRecurrence' with value: '{endTime=2023-05-26T14.39.44, timeZone=Europe/Copenhagen, startTime=2023-05-26T13.39.44}' was &lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="terminal,monaco" size="2"&gt;&lt;STRONG&gt;not found in the schema","parameterLocation":"PAYLOAD_BODY","location":null},{"path":"builtin:alerting.maintenance-window/0/gen&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="terminal,monaco" size="2"&gt;&lt;STRONG&gt;eralProperties/disableSyntheticMonitorExecution","message":"Given property 'disableSyntheticMonitorExecution' with value: &lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="terminal,monaco" size="2"&gt;&lt;STRONG&gt;'true' violates the following constraint: Must be of type boolean.","parameterLocation":"PAYLOAD_BODY","location":null},{"path"&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="terminal,monaco" size="2"&gt;&lt;STRONG&gt;:"builtin:alerting.maintenance-window/0/filters/0/entityId","message":"Given property 'entityId' with value: 'null' violates &lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="terminal,monaco" size="2"&gt;&lt;STRONG&gt;the following constraint: Please use a format of TYPE-ID.","parameterLocation":"PAYLOAD_BODY","location":null},{"path":"builtin&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="terminal,monaco" size="2"&gt;&lt;STRONG&gt;:alerting.maintenance-window/0/filters/0/entityId","message":"Given property 'entityId' with value: 'null' violates the&lt;/STRONG&gt; &lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2023 08:10:24 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/213231#M3541</guid>
      <dc:creator>Naveen</dc:creator>
      <dc:date>2023-05-26T08:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: Creating maintenance window using setting API</title>
      <link>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/213261#M3544</link>
      <description>&lt;P&gt;&lt;a href="https://community.dynatrace.com/t5/user/viewprofilepage/user-id/51963"&gt;@Naveen&lt;/a&gt;&amp;nbsp;there are several Syntax errors in your Json. please use the following to post your MZs via the API. You will need to update the start/end time tho.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[
{
  "scope": "environment",
  "schemaId": "builtin:alerting.maintenance-window",
  "schemaVersion": "2.14.2",
  "value": {
    "enabled": true,
    "generalProperties": {
      "name": "Maintenance windows",
      "description": "Maintenance windows are typically planned, recurring periods of system downtime during which your DevOps team can perform preventative maintenance and system upgrades outside of peak traffic hours.",
      "maintenanceType": "UNPLANNED",
      "suppression": "DONT_DETECT_PROBLEMS",
      "disableSyntheticMonitorExecution": true
    },
    "schedule": {
      "scheduleType": "ONCE",
      "onceRecurrence": {
        "startTime": "2023-07-25T13:45:00",
        "endTime": "2023-08-22T14:45:00",
        "timeZone": "Europe/Vienna"
      }
    },
    "filters": []
  }
}
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So what were you missing?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ChadTurner_0-1685102274275.png" style="width: 999px;"&gt;&lt;img src="https://community.dynatrace.com/t5/image/serverpage/image-id/11899i5D76EC8E8230A8A7/image-size/large?v=v2&amp;amp;px=999" role="button" title="ChadTurner_0-1685102274275.png" alt="ChadTurner_0-1685102274275.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;1 - Schema Version was missing&lt;/P&gt;&lt;P&gt;2 - Conflicting names and descriptions&amp;nbsp;&lt;/P&gt;&lt;P&gt;3 - No Date with your time stamp for both start and end&amp;nbsp;&lt;/P&gt;&lt;P&gt;4 - Missing the filters segment&lt;/P&gt;&lt;P&gt;5 - Bracket/Braces were not correct.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please save this as a gold template for you to leverage with posting of MWs via the API&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2023 12:02:40 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/213261#M3544</guid>
      <dc:creator>ChadTurner</dc:creator>
      <dc:date>2023-05-26T12:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: Creating maintenance window using setting API</title>
      <link>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/226735#M3825</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried to use this code to create a MW from Servicenow via REST and I am getting the following error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*** Script: {"error":{"code":400,"message":"Could not map JSON at '' near line 1 column 1"}}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code is the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var rm = new sn_ws.RESTMessageV2(); 
var jsonObj =   {
  "scope":"environment",
  "schemaId":"builtin:alerting.maintenance-window",
  "schemaVersion":"2.14.2",
  "value":{
     "enabled":true,
     "generalProperties":{
        "name":"TEST INTEGRATION",
        "description":"This a test for maintenance window via API",
        "maintenanceType":"PLANNED",
        "suppression":"DONT_DETECT_PROBLEMS",
        "disableSyntheticMonitorExecution":true
     },
     "schedule":{
        "scheduleType":"ONCE",
        "onceRecurrence":{
           "startTime":"2023-12-29T13:45:00",
           "endTime":"2023-12-30T14:45:00",
           "timeZone":"Europe/Vienna"
        }
     },
     "filters":[
        
     ]
  }
};
rm.setEndpoint('https://{environmentid}.live.dynatrace.com/api/v2/settings/objects'); 
rm.setHttpMethod('POST'); 
rm.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
rm.setRequestHeader('entities.write', 'application/json;charset=UTF-8');
rm.setRequestHeader('Accept', 'application/json; charset=utf-8');
rm.setRequestHeader('Authorization', 'Api-Token dt0c01.......');
rm.setRequestBody(JSON.stringify(jsonObj));


var response = rm.execute();
var responseBody = response.getBody(); 

gs.print(responseBody);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I dont understand why this is not being able to parse the JSON.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Gabriel&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 13:35:01 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/226735#M3825</guid>
      <dc:creator>gabrielsantos</dc:creator>
      <dc:date>2023-10-26T13:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Creating maintenance window using setting API</title>
      <link>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/226736#M3826</link>
      <description>&lt;P&gt;You need to add square brackets at the start and end of your JSON or the API gets confused, so just add&amp;nbsp;&lt;STRONG&gt;[&lt;/STRONG&gt; and&amp;nbsp;&lt;STRONG&gt;]&lt;/STRONG&gt; at the start and end of your JSON body respectively.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 13:25:01 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/226736#M3826</guid>
      <dc:creator>victor_balbuena</dc:creator>
      <dc:date>2023-10-26T13:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: Creating maintenance window using setting API</title>
      <link>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/226738#M3827</link>
      <description>&lt;P&gt;Amazing Victor, thank you very much!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Oct 2023 13:33:17 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/226738#M3827</guid>
      <dc:creator>gabrielsantos</dc:creator>
      <dc:date>2023-10-26T13:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: Creating maintenance window using setting API</title>
      <link>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/235453#M4064</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Is there a way to fetch the entity ID against whom we need to create a maintenance window and use it in the same script, or how does it work to schedule MW for specific entity?&lt;/P&gt;</description>
      <pubDate>Thu, 25 Jan 2024 09:03:17 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/235453#M4064</guid>
      <dc:creator>wipkumv3</dc:creator>
      <dc:date>2024-01-25T09:03:17Z</dc:date>
    </item>
    <item>
      <title>Re: Creating maintenance window using setting API</title>
      <link>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/266597#M5337</link>
      <description>&lt;P&gt;Hi Naveen&lt;/P&gt;&lt;P&gt;Please tell me how we have to deploy this json script so that we can automatically apply maintenance windows,or create an automated path for maintenance window.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Jan 2025 09:19:12 GMT</pubDate>
      <guid>https://community.dynatrace.com/t5/Alerting/Creating-maintenance-window-using-setting-API/m-p/266597#M5337</guid>
      <dc:creator>prakhardt</dc:creator>
      <dc:date>2025-01-03T09:19:12Z</dc:date>
    </item>
  </channel>
</rss>

